This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Middleware Error on Production (No Secret) #4411
Labels
question
Ask how to do something or how something works
Environment
System:
OS: macOS 12.3
CPU: (10) x64 Apple M1 Pro
Memory: 24.96 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.0 - /usr/local/bin/node
npm: 8.3.1 - /usr/local/bin/npm
Browsers:
Chrome: 100.0.4896.88
Firefox: 97.0.1
Safari: 15.4
npmPackages:
next: latest => 12.0.8
next-auth: ^4.3.2 => 4.3.2
react: ^17.0.2 => 17.0.2
Reproduction URL
Describe the issue
I use this code block to detect if the user is authenticated or not. It works perfectly on local but it doesn't work on the production.
The error is "No Secret" but I already provided the NEXTAUTH_SECRET environment variable to the Vercel and I can verify that with successful login and cookie creation. Somehow, Middleware can't access the variable or there is something else.
How to reproduce
You can push your app with a middleware setup and try to use the code block that I provided or from the documentation.
Expected behavior
The code block should detect if the user is logged in or not.
The text was updated successfully, but these errors were encountered: