-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix: throw MissingSecret
when secret missing
#10305
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10305 +/- ##
===========================================
+ Coverage 39.37% 80.77% +41.39%
===========================================
Files 171 12 -159
Lines 27278 2445 -24833
Branches 1165 160 -1005
===========================================
- Hits 10742 1975 -8767
+ Misses 16536 470 -16066 ☔ View full report in Codecov by Sentry. |
I have AUTH_SECRET in my .yaml file and it works in beta.5 but in beta.16 I am getting |
Bump! I m also getting "Missing secret, please set AUTH_SECRET or config.secret. Read more at https://errors.authjs.dev#missingsecret" in my .env i have tried AUTH_SECRET and NEXTAUTH_SECRET Also tried setting it to SECRET and using that in auth.js in config and setting config.secret to that... Also localhost works, but in CI or in Production seems to break Screenshot from production environment (only shows error on client console there is no logs) |
Hey folks, yeah so setting the |
Checked my production container for environment variable and AUTH_SECRET is set @ndom91 Let me know what to do as this is kind of urgent, thanks! |
@DonikaV Found a fix for now Use beta15 instead of beta16 |
Please revert this merge. |
I can't reproduce this in dev and prod builds of SvelteKit apps with Auth.js nor in dev / prod Next.js apps 🤔 Can you all provide some more details about your setups? |
@ndom91 we're build a container with nextjs and then we ship the |
I am not ops specialist. Only knows that we could containers in GitHub CI and using a Docker file along with the yaml files for each of environments. And the beta15 version also has errors in the production build. So the last working version is beta.5 😀 |
Having same issue as @adamspotlite we keep our secrets in aws secret manager and they are not available at build step only at runtime. We need to be able to build the code and then at runtime pass the secret. |
Facing the same issue where secret is not known at build time and this change breaks the build if the secret is only known at runtime. |
* feat: throw for missing secret * fix: env tests for missing secret --------- Co-authored-by: Thang Vu <[email protected]>
* feat: throw for missing secret * fix: env tests for missing secret --------- Co-authored-by: Thang Vu <[email protected]>
Can't preview or deploy to Cloudflare Pages, when trying preview it reports same ERROR message. |
This comment was marked as spam.
This comment was marked as spam.
Hello everyone,
Same behaviour here. I'm receiving the error message even if I set up
What is really wired to me is that if I do a // auth.config.ts
console.log("secret:", process.env.AUTH_SECRET);
export const authConfig: NextAuthConfig = {
providers: [...],
secret: process.env.AUTH_SECRET,
...
} and the output is
proving that the secret is valid each time the config is invoked. But still I receive the missing AUTH_SECRET error.
Tried also with Apparently hardcoding the secret in the auth config is the only working method. |
☕️ Reasoning
MissingSecret
ifconfig.secret
wasn't set, but not early enough in the flow, so a missingAUTH_SECRET
got through in early signin and threw a mysterious error when passed to hkdfAUTH_SECRET
isn't set in our coresetEnvDefaults
fn, since that's the only core place where one ofconfig.secret
orAUTH_SECRET
should definitely have been set already. If you know a better place for it I'm all ears though 👍Previous error msg on missing
AUTH_SECRET
:New error msg:
🧢 Checklist
🎫 Affected issues
📌 Resources