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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[node] Add isomorphic functions #9947
Conversation
馃 Changeset detectedLatest commit: 9ad8318 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't manually test this yet, but it's looking awesome
there is a bug in node-fetch that requires to don't use localhost node-fetch/node-fetch#1624
if (!message.startsWith('Error:')) { | ||
message = `Error: ${message}`; | ||
} | ||
console.error(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an improvement, but I realized we show errors differently between startup/runtime and serverless-node/edge. We should standardize those differences, but not in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. I tested a handful of scenarios and didn't find any issues.
// @ts-expect-error - `node-fetch` Headers is missing `getAll()` | ||
Headers, | ||
}); | ||
const toHeaders = buildToHeaders({ Headers }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how this TS error was fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrading @edge-runtime/node-utils
fixed the issue I think because of this PR: vercel/edge-runtime#309
This PR allow using Web APIs in Serverless functions
More about that https://nextjs.org/docs/app/building-your-application/routing/router-handlers