Closed puzzle-it-nu closed 2 months ago
Hi @puzzle-it-nu 👋
I agree with your take here! However, we have to be careful. As we use NextAuth under the hood, certain environment variables need to be set via process.env
to allow NextAuth to access these. One of these is e.g. NEXTAUTH_URL
.
I have had reworking the environment variables and configuration for NuxtAuth on my list for a while, as I feel that at the moment it is very difficult to properly assess which environment variables need to be set for which provider. I would love to work with you on improving this!
In my opinion, we should begin by outlining which configuration and environment variables are required for which settings and how we can make them feel more native to Nuxt. I also know that we still have a few PR opens that also touch the environment variables (notably: https://github.com/sidebase/nuxt-auth/pull/711). In addition to this, I think we need to update the docs and properly outline the possibilities for how configurations can be set. There is often confusion about this (See: https://github.com/sidebase/nuxt-auth/issues/368)
In conclusion: I would love to receive some help from you on this issue! I personally would propose that we as a first step outline the changes and get a proper overview of what could be improved. Afterward, it would be amazing, if you opened a PR to account for these. Alternately, you can also immediately open a PR, however we may request substantial changes, depending on the changes!
If I can support you in any, feel free to ping me on GitHub or add me on discord (zoeykaiser) 😊
Thanks for the heads up and detailing some of the difficulties that I didn't know about.
My, naive, thinking was that using only useRuntimeConfig()
should work but I can imagine that some parts of the code really depend on process.env
being available. Those parts that don't should be able to use useRuntimeConfig
and I think the docs should reflect that.
I have read the mentioned PR and issue and I wonder whether it would be possible to come up with reproductions and/or a table listing working/not working combinations. Right now I have a hard time keeping track of what works and what doesn't.
Personally I haven't had the above mentioned problems but that doesn't mean they don't exist.
I'm gone on a 2 week vacation and hope to have time after that to look into it.
Potentially resolved by https://github.com/sidebase/nuxt-auth/pull/837
Closing as in #837 we now switched to a more flexible approach where both normal and Nuxt environment variables can be used.
Environment
First of all thanks for all you hard work, really appreciate it.
Reproduction
Its an issue about documentation, so rather hard to reproduce :-)
Describe the bug
The following came up during a discussion with a new team member on our Nuxt3 project. According to the Nuxt documentation you shouldn't use process.env to get at environment variables. What happens if you build for a deployment that doesn't have a process object just like SSR doesn't have a windows object.
Shouldn't this example use Nuxt3 best practices?
If you agree I'm willing to write a PR for this instance and also for other instances if there are any.
Additional context
No response
Logs
No response