amplify-hosting
amplify-hosting copied to clipboard
Can not find the Environment variables section in AWS Console.
** Please describe which feature you have a question about? **
This is my AWS amplify console:
** 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.
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?
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 the env variables are not available as they are related to the CI/CD process.
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
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.
Any update on this ? I still cannot make the env vars working properly =/
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.
It's sad that this issue is over 3 years old and no one from AWS every helped resolve it.