-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: make env vars optional #585
Comments
Actually, I'm still having issues when I try to build
|
I put random values into my .env, and now I'm getting
I realize this is because I made those objects Now I'm facing
with env vars /src/.env
|
I see now that server.mjs / line 10 (const _serverEnv = serverSchema.safeParse(process.env)) is actually grabbing the environment variables. I finally had the sense to make another npx create-t3-app@latest and noticed that the .env lives one folder up from /src with the following data
Now building works and yarn dev working 🥳 |
Perhaps the solution is to improve the docks slightly about what to do if you pull to a different machine Thanks! |
Yes .env should be in the project root. Maybe we should have a committed version of .env-example with the default values so that one can copy those if they pull the repo from remote? |
I'm getting the same error, just following Theo's tutorial on youtube: ` ❌ Invalid environment variables: {06:37:07.637 | NEXTAUTH_SECRET: [ 'Required' ], |
What about postgresql where DATABASE_URL is not needed? It should be optional, isn't it? |
why would a connection URL not be needed for postgres? |
@c-ehrlich because it uses the variable POSTGRES_URL, etc |
then you should change your |
Is your feature request related to a problem? Please describe.
I pulled my t3 app on my laptop at an internet cafe (I wanted to do a little UI work). Trying to run it locally, I'm confronted with
❌ Invalid environment variables:
DATABASE_URL: Required
NEXTAUTH_SECRET: Required
NEXTAUTH_URL: Required
DISCORD_CLIENT_ID: Required
DISCORD_CLIENT_SECRET: Required
I created a
.env
and stuck it in my src folder with those variables with empty valuesStill doesn't work.
I then added
optional
to them hereAnd that fixed the problem.
Describe the solution you'd like to see
I believe these env vars should be optional from the start. People who are just starting out my just want to be focusing on their frontends and not have to worry about environment issues.
Desribe alternate solutions
You probably have a better solution than the one I proposed.
Just make source buildable out-of-the-box if someone were to push to their remote, then pull to another machine.
Additional information
No response
The text was updated successfully, but these errors were encountered: