Coder Social home page Coder Social logo

Comments (6)

hazamashoken avatar hazamashoken commented on May 18, 2024 1

Current workaround is to just set anything to AUTH_SECRET during build time and change the env variable again during runtime. But yea this is very annoying.

from next-auth.

SpectralAngel avatar SpectralAngel commented on May 18, 2024 1

It is not even reading the secret while using npm next dev, the check for AUTH_SECRET should not be there until the app has been completely initialiazed, that means until the environment variables have been loaded (build time is bad for it also)

from next-auth.

balazsorban44 avatar balazsorban44 commented on May 18, 2024

Hi all,

Current workaround is to just set anything to AUTH_SECRET during build time

This would be my suggestion too. The reason for this is that some path in your code might be hit during prerendering (next build) that relies on auth. This will result in the AUTH_SECRET check invocation.

  1. You can set it to a dummy value, just make sure that the production version has a properly set secret. You can use npx auth secret for example.
  2. Or you can try to figure out what invoked authentication. The missing secret check is already a runtime check.

It is not even reading the secret while using npm next dev,

This sounds unrelated and something specific to your project. Next.js reads environment variables as a priority so they should always be available before the dev server is initialized. I cannot tell more without seeing your code, but it's most likely nothing to do with Auth.js.

from next-auth.

StuartMorris0 avatar StuartMorris0 commented on May 18, 2024

I have the same issue with a turborepo project. AUTH_SECRET is set in an env file and is also included in turbo config.

It doesn't appear to be used. I presume pnpm dev is using the env.local and the pnpm build even when run locally is not using .env.local or not finding the value for some reason.

Rolling back to the previous beta version does resolve the issue for now

from next-auth.

StuartMorris0 avatar StuartMorris0 commented on May 18, 2024

I don't think the issue is resolved just yet @balazsorban44

from next-auth.

balazsorban44 avatar balazsorban44 commented on May 18, 2024

Please open a new issue with a minimal reproduction then. Please don't give a full monorepo that takes a lot of time to set up, please strip it down to the bare minimum that still reproduces the issue, if the monorepo setup is even relevant. if it reproduces without one, please provide a simple repo isntead.

Saying that it's not resolved is not actionable.

from next-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.