browser.tab.getCurrent() not returning anything

I’m running this in my content script:

  console.log("here");
  browser.tabs.getCurrent()
    .then(getTab)
    .catch(reportTabError);
    function reportTabError(error) {
      console.error(`Could not process: ${error}`);
    }       
    function getTab(tabInfo){
      console.log("here 2");
      window.currentTabId = tabInfo.id;
    }

It seems that getTab is never fired. Also tried this one, same result:

  console.log("here");
  browser.tabs.query({currentWindow: true, active: true})
    .then(getTab)
    .catch(reportTabError);
    function reportTabError(error) {
      console.error(`Could not process: ${error}`);
    }       
    function getTab(tabInfo){
      console.log(tabInfo.id);
      //window.currentTabId = tabInfo.id;
    }

Content scripts doesn’t have access to some API, including browser.tabs API, you have to ask your background script.

And you don’t see error in the console because the logger is broken for content scripts: