amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

Can not find the Environment variables section in AWS Console.

Open Albert-Gao opened this issue 5 years ago • 8 comments

** Please describe which feature you have a question about? **

This is my AWS amplify console:

image

** Provide additional details**

I don't use Amplify to manage my front-end deployment. But I want to use the environment variables to control the build of my lambda code.

Albert-Gao avatar Feb 17 '20 09:02 Albert-Gao

Hey @Albert-Gao can you provide some additional details? What is your app ID/region?

Also it seems you have only deployed a backend (But not a front-end).

Did you deploy it through the amplify CLI?

ganipcanot avatar Feb 17 '20 19:02 ganipcanot

It is dd12d0y1kpown in us-east-1.

I only use amplify for my back-end, from the CLI

I had a quick discussion here: https://github.com/aws-amplify/amplify-console/issues/257

Albert-Gao avatar Feb 17 '20 21:02 Albert-Gao

@Albert-Gao the env variables are not available as they are related to the CI/CD process.

swaminator avatar Feb 18 '20 21:02 swaminator

and the CI/CD is not for the backend? For the back-end, I just want to set up some env var which I don't want to commit to the repo for the security reason. How could I do it? Thanks

Albert-Gao avatar Feb 18 '20 22:02 Albert-Gao

I'm curious about this too. If I misread the documentation, please let me know. Here's my setup.

I'm using Amplify Console to deploy my front end and back end. In my front end code (React), I've configured Amplify with the env vars.

import Amplify from 'aws-amplify';
import configuration from '../aws-exports';
Amplify.configure({
    ...configurations, // generated from amplify
    API: {
        graphql_endpoint: process.env.APPSYNC_GRAPHQL_URL,
        graphql_headers: async () => ({
            'x-api-key': process.env.APPSYNC_API_KEY,
        }),
    },
});

I can read these locally. But when its deployed, whether through CI/CD or manually clicking the "Redeploy this version" button, the errors I get when I visit the deployed site are "no graphql endpoint provided". While this error isn't produced by Amplify, it seems to be that the environment variables that I've saved in Amplify Console isn't read.

After setting up the environment variables in build settings, my amplify.yml file looks like this for the frontend:

frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - APPSYNC_GRAPHQL_URL=$APPSYNC_GRAPHQL_URL
        - npm run build
  artifacts:
    baseDirectory: public
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Any tips on how to debug this would be greatly appreciated. Thanks.

vientang avatar Feb 23 '20 22:02 vientang

Any update on this ? I still cannot make the env vars working properly =/

MarcoEmm avatar Aug 27 '20 18:08 MarcoEmm

Same here. Need to put in API KEYS and URL locations as env variables but not able to if I don't use CI/CD?

I just use amplify push/publish to deploy.

BernhardSmuts avatar Nov 27 '21 12:11 BernhardSmuts

It's sad that this issue is over 3 years old and no one from AWS every helped resolve it.

shellscape avatar Oct 12 '23 00:10 shellscape