-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: can't build docker image with NextAuth.js #992
Comments
Your error isn't from the environment variable validation from next.config (hence turning on the flag wont do anything) Not sure why it doesn't recognize the custom /sign/in route though... |
From what I googled, it looks like that Next is trying to run Unfortunately, I was unable to find out why is this happening and how to fix that. I checked the example from Next documentation for authentication (with NextAuth.js), if I am not missing something and I believe I am not. I find a discussion at vercel/next.js (see vercel/next.js#35534), yet I did not find a solution to this issue. EDIT: The I find it super weird, since this is exactly the way it is shown as an example in NextAuth.js's docs: https://next-auth.js.org/tutorials/securing-pages-and-api-routes#server-side 👨 🔫 |
cc @c-ehrlich @ajcwebdev You have more Docker experience than I have. Any ideas? |
The gssp => env vars theory sounds plausible. Will try to take a closer look at this sometime soon but might end up being after Christmas. |
@c-ehrlich Ok, thank you. Completely understood, happy holidays 🎄 |
bump, cc @c-ehrlich |
reminder cc @c-ehrlich Can you please have a look? Thank you |
hey I stumbled across this thread because of invalid NEXTAUTH_URL on my static generated pages when deploying to digital ocean after upgrading my t3 app what worked for me was changing 'mywebside.com' to 'http://www.mywebside.com' in my env variables |
@sebakocz well I know for sure that the value of Your solution does not solve my problem. Thanks tho. |
Sorry for the delay. I was able to reproduce your issue and then got it working including GSSP. The reason it was breaking is that we were only checking for Here's the env schema file of my working repo: https://github.com/c-ehrlich/docker-next-auth/blob/main/src/env.mjs - it's a slightly modified version of what Julius is working on in #1092 Hope it's ok that I built it from scratch instead of using your project, but I'm fairly sure it covers the exact thing you're running into (I copy pasted some bits from your project). Let me know if it works for you :) |
Thanks @c-ehrlich, the issue is now resolved. Thank you for looking into it. |
Provide environment information
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Pro
Memory: 111.53 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.3.0 - /opt/homebrew/bin/node
npm: 9.2.0 - /opt/homebrew/bin/npm
pnpm: 7.18.2
ct3aMetadata.initVersion: 6.11.2
Describe the bug
Build of my Next app fails due to missing env variables (I am using the SKIP_ENV_VALIDATION=1 env var) and
Error: Failed to collect page data for /sign/in
To reproduce
ci-docker-build
docker build -t platform .
orSKIP_ENV_VALIDATION=1 pnpm run build
Additional information
I believe that the
SKIP_ENV_VALIDATION
env var is not being passed to the app.If I run the
pnpn run build
outside docker without/.env
(/
is project root) file, I get the same error. Altho I was unable to turn off the validation even when I commented out the import in/next.config.mjs
.I believe that the environment schema is checked when page data collection starts, since I was able to get this error for different pages.
Unfortunately I was unable to get around this issue.
I am using Next.js version
13.0.6
The text was updated successfully, but these errors were encountered: