t3 turbo env vars
So I have a secret key that i am using in one of my api routes. Everything works fine but when i go to deploy in AWS amplify it doesnt work. I added it to the environment variables... I tried building
with-env
not sure why its not working.
Also have this issue with my cloudflare envs in amplify.
19 Replies
hey @marminge sorry for the tag but i think you might know the solution to this
just found out amplify doesnt make the env vars accessible in runtime
ok so
this is what i have right now
whatelse do i need to change?
im so lost
this works perfectly locally
Im not familiar with amplify but if they dont populate process.env that’s the issue you need to fix first
they do just not in SSR
so the clerk and prisma stuff work fine
but then the cloudflare stuff that i have in my api endpoints that use the process.env dont
Making environment variables accessible to server-side runtimes - A...
Amplify Hosting supports adding environment variables to your application's builds by setting them in the project's configuration in the Amplify console. However, a Next.js server component doesn't have access to those environment variables by default. This behavior is intentional to protect any secrets stored in environment variables that your ...
tried this out and didnt work for me
You can bump a question just by commenting in it.
Do you HAVE to use Amplify?
no not really what else would you recommend
vercel is too expensive
if you are confused i got a the t3 monorepo
with nextjs and expo
cloudflare
the issue isnt cloudflare i promise you
sst (for serverless)
or are u recommending services
oh yeah SST
i forgot about that
lmao
😭
with sst you can easily use env vars using secret manager
If I am confused... lmfao
im gonna link what im using right now
https://github.com/clerkinc/t3-turbo-and-clerk
i think the issue is the location of the .env
maybe its adding it tp apps/nextjs
instead of root
i think ill just go ahead and use SST fucking forgot about it
quick update
my friend managed to fix it
i have no clue how
but now getting a wonderful prisma error 😄
time to solve that one
Try to get your friend to describe how here and mark it as an answer please.
ok
So basically in the build commands he added
replace MY_ENV with ur vars
then inside next.config.mjs in const config add env
and that pretty much it
GitHub
amplify-hosting/FAQ.md at main · aws-amplify/amplify-hosting
AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications. - amplify-hosting/FAQ.md at main · aws-amplify/amplify-hosting