0

Following the docs, I set my environment variable in the console ($CLIENT_ID). In the console I added the echo command to try and insert the variable into a .env.

The error I keep getting is There was an issue connecting to your repo provider. When I remove the echo line the build passes. I've tried single/double quotes and putting the line above/below the other lines under the build commands phase.

Here's the backend section for the build process.

backend:
  phases:
    build:
      commands:
        - echo 'CLIENT_ID=$CLIENT_ID' >> backend/.env
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
axecopfire
  • 512
  • 5
  • 16
  • Please check [this question](https://stackoverflow.com/questions/64072288/how-to-add-environment-variables-to-aws-amplify). I think it is what you asked for. – Pablo LION Sep 26 '21 at 01:51
  • Does this answer your question? [How to add environment variables to AWS amplify?](https://stackoverflow.com/questions/64072288/how-to-add-environment-variables-to-aws-amplify) – Pablo LION Sep 26 '21 at 01:56

2 Answers2

1

I wrote an comment but to make it easier, I quote from answers from this question

build:
      commands:
        - npm run build
        - VARIABLE_NAME_1=$VARIABLE_NAME_1 # it works like this
        - VARIABLE_NAME_2=${VARIABLE_NAME_2} # it also works this way

Please thumb up on the original answers, and flag this question as duplicated.

Pablo LION
  • 1,294
  • 6
  • 20
0

Seems this is a feature request: https://github.com/aws-amplify/amplify-cli/issues/4347

axecopfire
  • 512
  • 5
  • 16