【问题标题】:Amplify save environment variables to backend放大保存环境变量到后端
【发布时间】:2021-05-16 12:09:30
【问题描述】:

the docs 之后,我在控制台中设置了我的环境变量 ($CLIENT_ID)。 在控制台中,我添加了 echo 命令以尝试将变量插入.env

我不断收到的错误是There was an issue connecting to your repo provider。当我删除 echo 行时,构建通过。我尝试了单引号/双引号,并将该行放在构建命令阶段下的其他行之上/之下。

这是构建过程的后端部分。

backend:
  phases:
    build:
      commands:
        - echo 'CLIENT_ID=$CLIENT_ID' >> backend/.env
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple

【问题讨论】:

标签: environment-variables aws-amplify


【解决方案1】:

我写了一条评论,但为了方便起见,我引用了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

请点赞原始答案,并将此问题标记为重复。

【讨论】:

    【解决方案2】:

    似乎这是一个功能请求: https://github.com/aws-amplify/amplify-cli/issues/4347

    【讨论】:

      猜你喜欢
      • 2018-06-04
      • 1970-01-01
      • 2021-01-12
      • 2021-09-11
      • 2021-10-13
      • 1970-01-01
      • 2020-05-30
      • 2020-12-07
      • 2015-11-01
      相关资源
      最近更新 更多