How to expose build time enviromental variables

1

I'm building a full stack application with Next.js framework and want to deploy it to App Runner. How ever Next.js needs to have enviromental variables (secrets) on build time, otherwise build fails. This is stated clearly on Next.js documentation. How ever it seems that in App Runner I'm only able to expose environmental variables on runtime. Is there any way to get secrets from secret manager and set env values on build time? I do not wish to have my ens on client side so NEXT_PUBLIC_ prefix is not a solution around this.

I'm using apprunner.yml config file and deploy automatically from Github repository.

Here is my apprunner.yml config file content:

version: 1.0 runtime: nodejs16 build: commands: build: - yarn --production - yarn build run: command: yarn start network: port: 3000 env: - name: PRIMARY_DB_NAME value: "primary" secrets: - name: DB_URI value-from: "arn:here"

  • Having the same issue. Is this is a case of having to utilize ECR to have more flexibility over the dockerfile?

Aucune réponse

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions