itslekan
itslekan2w ago

Error: `headers` was called outside a request scope.

I recently switched devices and I wanted to continue working on my project. So I pulled all the code from github and ran convex dev. Everything seemed to be working find and even the env's got filled in as well. This project is currently running in production on vercel so I know it works. But when I try to run it I keep getting this error
Error: `headers` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context
Error: `headers` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context
After some debugging. I've norrowed down the problem to be in the convexAuthNextjsMiddleware. I cleared my previous middleware and copy pasted the default middleware and still the same error. I can't figure out what I'm doing wrong. I'll appreciate any help I could get. Thank you.
2 Replies
Convex Bot
Convex Bot2w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
itslekan
itslekanOP2w ago
I was able to resolve this by installing node