Open hrougier opened 1 year ago
Thanks for this super detailed report!
The @vercel/edge-config
package uses conditional exports: one for node and one for edge. Seems like there was a regression in Next.js which causes the node export to be used inside of the edge runtime. We're looking into it.
As a workaround in the meantime, you could either
@vercel/edge-config
to version 0.1.1
13.1.6
This is now fixed in @vercel/edge-config
v0.1.5. We are also working on fixing the regression in Next.js itself.
The underlying issue was that if a package uses conditional exports for "node" and "default" then edge-light
runtime code would match "node" instead of "default". Explicitly adding an entry for edge-light
serves as a workaround until the regression is fixed in Next.js itself.
Thank you for all the explanations and the quick feedback! Appreciate it!
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true), Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/recursing-leaf-ei4qfd
To Reproduce
Describe the Bug
The node export of @vercel/edge-config is used at build time making the build fail with the following error
Expected Behavior
Import and use @vercel/edge-config in edge runtime server components even if the primary use case of @vercel/edge-config is to be used in middleware.ts (which works as expected).
This also happens in app route handlers using runtime = 'experimental-edge', whereas it works in API routes with a runtime: 'edge' config.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel
NEXT-862