Skip to content

Injecting runtime environment variables for a React App #2001

Answered by efekarakus
vonphlpp asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @vonphlpp !

The steps that you have taken look good to me, the only difference that I see between the docs and above is the type of the SSM parameter: String instead of SecureString.

When you open up the console do you see the environment variables available under the containers tab?

I believe the reason why this is happening is that your React application expects the environment variables at "build-time" (while building the docker image), whereas Copilot passes down these variables at runtime (running your built image). I believe you'd need to wrap your React service around an API like with Express.js. The explanation under "Runtime variables" in this blog post (https://medium.com/@a…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vonphlpp
Comment options

@efekarakus
Comment options

Answer selected by vonphlpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants