next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

Make `getToken` work on Cloudflare Workers by not eagerly evaluating defaults

Open AlexErrant opened this issue 2 years ago • 2 comments

☕️ Reasoning

Cloudflare Workers don't define process.env. getToken defaults to process.env in an eager fashion, resulting in errors like "process is not defined". This PR uses ??= to set some params lazily.

🧢 Checklist

  • [ ] Documentation
  • [ ] Tests
  • [x] Ready to be merged

AlexErrant avatar Apr 25 '23 16:04 AlexErrant

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 25, 2023 4:24pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Apr 25, 2023 4:24pm

vercel[bot] avatar Apr 25 '23 16:04 vercel[bot]

@AlexErrant is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 25 '23 16:04 vercel[bot]

This makes a lot of sense. Are you still interested in getting this merged? If so, please check out the merge conflict :pray:

ndom91 avatar Feb 24 '24 18:02 ndom91

Looks like getToken on main no longer uses process.env

AlexErrant avatar Feb 24 '24 21:02 AlexErrant