Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

globals.Headers is not a constructor #174

Open
nlaitan opened this issue Apr 13, 2021 · 4 comments
Open

globals.Headers is not a constructor #174

nlaitan opened this issue Apr 13, 2021 · 4 comments

Comments

@nlaitan
Copy link

nlaitan commented Apr 13, 2021

I get this error on a production environment, not in development mode. When I acess to link with a nuxt link in page, error doesn't ocurrs, only ocurrs when I enter on the page with url directly (refreshing for example also ocurrs)

Error stack:

ERROR  globals.Headers is not a constructor
  at mergeHeaders (node_modules_dev/ky/index.js:52:0)
  at deepMerge (node_modules_dev/ky/index.js:88:0)
  at validateAndMerge (node_modules_dev/ky/index.js:509:0)
  at Function.ky.<computed> [as get] (node_modules_dev/ky/index.js:516:0)
  at http_HTTP.module.exports.http_HTTP.<computed> [as get] (.nuxt/http.js:95:0)
  at http_HTTP.module.exports.http_HTTP.<computed> [as $get] (.nuxt/http.js:126:0)
  at asyncData (pages/catalogue.vue:36:0)
  at promisify (.nuxt/utils.js:278:0)
  at server.js:72810:23
  at Array.map (<anonymous>)
2021-04-13T02:52:13.304Z	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: globals.Headers is not a constructor","reason":{"errorType":"TypeError","errorMessage":"globals.Headers is not a constructor","stack":["TypeError: globals.Headers is not a constructor","    at mergeHeaders (node_modules_dev/ky/index.js:52:0)","    at deepMerge (node_modules_dev/ky/index.js:88:0)","    at validateAndMerge (node_modules_dev/ky/index.js:509:0)","    at Function.ky.<computed> [as get] (node_modules_dev/ky/index.js:516:0)","    at http_HTTP.module.exports.http_HTTP.<computed> [as get] (.nuxt/http.js:95:0)","    at http_HTTP.module.exports.http_HTTP.<computed> [as $get] (.nuxt/http.js:126:0)","    at asyncData (pages/catalogue.vue:36:0)","    at promisify (.nuxt/utils.js:278:0)","    at server.js:72810:23","    at Array.map (<anonymous>)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: globals.Headers is not a constructor","    at process.<anonymous> (/var/runtime/index.js:35:15)","    at process.emit (events.js:327:22)","    at processEmit [as emit] (/var/task/node_modules/signal-exit/index.js:161:32)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:94:32)"]}
Unknown application error occurred

error is on a page, in this part:

  async asyncData({ $http }) {
    const data = await $http.$get(`xxx`)
    return { data }
  }

nuxt.config.js

...
modules: [
  '@nuxt/http'
]
...
http: {
    baseUrl: process.env.API_URL,
},

Versions:

@nuxt/http: 0.6.4
nuxt: 2.14.12
@oritwoen
Copy link

I also have this bug on production Vercel.

 ERROR  TypeError: globals.Headers is not a constructor  at server.js:52993:11  at http_HTTP.module.exports.http_HTTP.<computed> [as get] (.nuxt/http.js:113:0)  at http_HTTP.module.exports.http_HTTP.<computed> [as $get] (.nuxt/http.js:126:0)

@thezzisu
Copy link

thezzisu commented May 3, 2021

+1 for Vercel.

globals.Headers is not a constructor

@varna
Copy link

varna commented Jun 14, 2021

Still doesn't work.
Might have something to do with sindresorhus/ky-universal#23
I tried to confirm that the latest release has https://github.com/nuxt/http/pull/121/files fix. But I can't wrap my head around which branch is 0.6.4

@varna
Copy link

varna commented Jun 14, 2021

I started receiving this after upgrading nuxt from 2.14.12 to 2.15.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants