Firefox error: NetworkError when attempting to fetch resource only from extension

  fetch, firefox, firefox-addon, javascript

[The problem has been solved, you can find the solution in my response]

I’m currently developing an extension for firefox/chrome that requires fetching some data from another website.

The extension seems to work fine from Chrome, however, I’m getting "NetworkError when attempting to fetch resource" when trying the extension from firefox.

IMPORTANT TO NOTE: if I execute the code from the console, it works just fine, the issue is only from the extension.

CORS is enabled on the server, any idea of what the source of the problem can be?

Serverside relevant code:

router.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  if (req.headers.authorization !== '***') {
      return res.status(403).json({ error: 'Unauthorized request' });

Clientside relevant code:

fetch('https://host:port/api/somepath', {
    headers: new Headers({
        Authorization: '*****',

Firefox error:

Error: TypeError: NetworkError when attempting to fetch resource

Extension manifest permissions:

"permissions": ["storage", "activeTab", "declarativeContent","webRequest", "webRequestBlocking", "webNavigation"],

Source: Ask Javascript Questions