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

[Vercel] Setting headers fails on Node18 Fetch API Response #5467

Closed
1 task done
shishkin opened this issue Nov 24, 2022 · 2 comments
Closed
1 task done

[Vercel] Setting headers fails on Node18 Fetch API Response #5467

shishkin opened this issue Nov 24, 2022 · 2 comments

Comments

@shishkin
Copy link
Contributor

What version of astro are you using?

1.6.10

Are you using an SSR adapter? If so, which one?

Vercel

What package manager are you using?

yarn

What operating system are you using?

Linux

Describe the Bug

Node 18 introduced Fetch API Response. When using it with Astro on Vercel, it fails with error:

{
  "errorType": "Runtime.UnhandledPromiseRejection",
  "errorMessage": "TypeError: response.headers.raw is not a function",
  "reason": {
    "errorType": "TypeError",
    "errorMessage": "response.headers.raw is not a function",
    "stack": [
      "TypeError: response.headers.raw is not a function",
      "    at setResponse (file:///var/task/node_modules/@astrojs/vercel/dist/serverless/request-transform.js:61:46)",
      "    at Server.handler (file:///var/task/node_modules/@astrojs/vercel/dist/serverless/entrypoint.js:22:11)",
      "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
    ]
  },
  "promise": {},
  "stack": [
    "Runtime.UnhandledPromiseRejection: TypeError: response.headers.raw is not a function",
    "    at process.<anonymous> (file:///var/runtime/index.mjs:1194:17)",
    "    at process.emit (node:events:525:35)",
    "    at process.emit (node:domain:489:12)",
    "    at emit (node:internal/process/promises:149:20)",
    "    at processPromiseRejections (node:internal/process/promises:283:27)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"
  ]
}

This is likely due to Vercel adapter using headers.raw(), not available on the Web API Headers class.

Is there a reason .raw() call is required?

Link to Minimal Reproducible Example

TBD

Participation

  • I am willing to submit a pull request for this issue.
@shishkin
Copy link
Contributor Author

Potentially duplicate of #5461

@bluwy
Copy link
Member

bluwy commented Nov 24, 2022

Yeah this is a duplicate of #5461

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
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

2 participants