Hi all, I am wondering if this is a NextJS issue o...
# sst
a
Hi all, I am wondering if this is a NextJS issue or a SST issue. Somehow I am not able to pass my env variables to Amplify configure. but it works if I set the configure directly. The
process.env
is printed alright in my terminal. Do my miss something? Do I have to prefix
NEXT_PUBLIC_
to these variables?
The error I get is
Copy code
Unhandled Runtime Error
NoUserPoolError: Authentication Error
confirmed that
NEXT_PUBLIC_
prefix makes it work..
d
You should consider near everything as the browser in the SST setup. The lambdas are edge lambdas, which have no environment variables, so they are essentially the same as "browser".
The exception are things you use during the build process.
y
@arda you should be able to set the env variables in NextJS config file that also gets passed into the context.
d
(as a replacement for the prefix)
a
i am a bit confused. some of your variables in your nextjs config file also have the prefix
but they are not mandatory I suppose?
d
they would work without being in the config, but it doesnt hurt anything to also include them
y
Right, you could expose private variables this way -- we just pass all env variables through this config as a practice
a
thank you both for the answers. it helps a lot 🙏