You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✓ Compiled middleware in 10ms
✓ Compiled in 5ms
⨯ 37 | return f;
38 | }
39 | function getServerError(error, type) {
40 | let n;
41 | try {
42 | throw new Error(error.message);
^
error: `headers` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context
The issue started when adding these lines to the middleware:
// middleware.tsimport{convexAuthNextjsMiddleware}from"@convex-dev/auth/nextjs/server";exportdefaultconvexAuthNextjsMiddleware();exportconstconfig={// The following matcher runs middleware on all routes// except static assets.matcher: ["/((?!.*\\..*|_next).*)","/","/(api|trpc)(.*)"],};
The issue dissapear as soon as the convexAuthNextjsMiddleware was removed from the middleware and changed to Next js default middleware.
// middleware.tsconstmiddleware=()=>{}exportconstconfig={// The following matcher runs middleware on all routes// except static assets.matcher: ["/((?!.*\\..*|_next).*)","/","/(api|trpc)(.*)"],};exportdefaultmiddleware;
Minimum folder structure
node_modules.next and public folder has been excluded
The issue appears when using SSA in Next JS
Runtime:
Bun version 1.1.34
Package version:
Error message:
The issue started when adding these lines to the middleware:
The issue dissapear as soon as the
convexAuthNextjsMiddleware
was removed from the middleware and changed to Next js default middleware.Minimum folder structure
node_modules
.next
andpublic
folder has been excludedLayout
Home
The text was updated successfully, but these errors were encountered: