AWS Amplify environment variables for pull requests?

Viewed 530

Good evening,

I am new with AWS Amplify.

We have a setup - I didn't set it up - where pull requests to our private Github repository trigger a 'preview' in AWS Amplify.

My understanding is that every preview gets its own preview URL, which is provided by AWS.

Now we have an app where I need to configure a redirect URI. Since the URL cannot be hard-coded I would like to inject it as environment variable at build time.

How can I get access to the URL value?

Only docs I found were these: https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html#amplify-console-environment-variables.

EDIT: Opened a question on Github as well: https://github.com/aws-amplify/amplify-console/issues/1310.

1 Answers

You can use AWS_PULL_REQUEST_ID.

This way, you can get the URL for the PR environment like:

https://pr-${AWS_PULL_REQUEST_ID}.${AWS_APP_ID}.amplifyapp.com
Related