Open mjfwebb opened 7 months ago
I just ran into this, came from the neo4j/graphql issue mentioned, the workaround is still valid but its a very obscure error, took me 3 days of searching until I found the GH issue...
/**
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
...
experimental: {
serverComponentsExternalPackages: ['graphql'],
},
};
Hi there, I found this error again, this time in a different context, it was in the API when creating the Apollo server instance, and for this case, the workaround worked, and still does.
However, now I have an issue with the client, the idea here is to use a SchemaLink
in the Apollo client wrapper, so the SSR part can query the DB directly, while the client part when the application has been Hydrated in the browser happens, it should use the HttpLink
.
If you need a reproduction repo of my specific issue where the error happens, here you go, just be aware you'll need a Neo4j database: https://github.com/luchillo17/graph-meister/tree/feature/schema-link-wrapper
Link to the code that reproduces this issue
https://github.com/mjfwebb/nextjs-neo4j-graphql-error
To Reproduce
To reproduce the error just run the repository code with
npm run dev
and open http://localhost:3000/api/graphql in your browser. You will encounter an error thrown by graphql:To circumvent this error, we have to add the graphql package to
serverComponentsExternalPackages
in next.config.js (this is currently commented out).Current vs. Expected behavior
I would expect this not to occur. This error can be circumvented using
serverComponentsExternalPackages
but it seems that graphql is a large enough library that it warrants being added to https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.jsonVerify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Middleware / Edge (API routes, runtime)
Additional context
No response