I have a next.js application which uses the Firebase-Admin SDK within its API routes. The Admin SDK requires a set of secrets, which are read from environment variables at runtime.
When I run the next build
command, these variables are expected to be available, or the process fails.
What actually happens in the build process, in terms of how the code is evaluated / invoked which means that the SDK is actually trying to read the variables?
Because the variables change per environment, is it normal to need to rebuild the source code for each environment as well?
This would mean that I would have to store the secrets in the build pipeline as well as the deployment environment, which I’d like to avoid unless it’s strictly necessary