-
Notifications
You must be signed in to change notification settings - Fork 574
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 Edge Runtime support #2247
Comments
We don't introduce integration packages for each platform. We use Fetch API just like Vercel Edge does. When I check the documentation, I see that it needs a function that takes import { createYoga, createSchema } from 'graphql-yoga'
export const config = {
runtime: 'edge',
};
const yoga = createYoga({
schema: createSchema({
typeDefs: /* GraphQL */ `
type Query {
greetings: String!
}
`,
resolvers: {
Query: {
greetings: () =>
'This is the `greetings` field of the root `Query` type',
},
},
}),
})
export default yoga |
Working great, although I did have to remap it to a NextResponse. |
Would be great if we have an example with integration tests in this repo. |
@alvarlagerlof How did you map it to NextReponse? |
What kind of remapping do you mean? |
Yes, I'm having some issues. I tried wrapping the handler like this:
That works better, but I get an error in Vercel saying: Did you not have to do anything else than copy the code above? What version of Next are you running? |
I ended up using yoga.fetch() and then creating a NextResponse and passing in text and the status. |
Polyfilling URLPattern did the trick, no idea why, Vercel says edge functions support URLPattern. I might try the fetch as-well. |
Hey @sigginjals @alvarlagerlof, I am working on adding an end2end integration test in #2471 to ensure a smooth integration. |
Is your feature request related to a problem? Please describe.
Support for using the Vercel Edge runtime with Next.js.
Describe the solution you'd like
Integration from the library, like how api routes work now.
The text was updated successfully, but these errors were encountered: