aws-amplify / aws-amplify/amplify-hosting

Accessing Secrets in Amplify Gen 1 App

Open
#4,029 1 comment 0 reactions 0 assignees View on GitHub
console feature-request
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Amplify CLI Version

12.12.3

### Question

I am trying to access secrets in my webhook. I am using Amplify Gen 1. I have entered the secrets under amplify > hosting settings > secrets, but I am unable to access them e.g. with `process.env.WEBHOOK_SECRET` (though accessing environment variables works fine) - but it just returns undefined when I log the secrets.

How can I access these secrets? On the amplify docs all I can see is "In Amplify Gen 1, you need to define environment variables and secrets using the CLI and store keys in both AWS Parameter Store and a local team-provider.json file."

Would be very helpful if there was actually further detail on accessing these. I cant see how I can do this in the CLI nor how the team-provider file should be edited.

Or is using `process.env.WEBHOOK_SECRET` just the wrong way to access them? If the secrets tab under hosting is just for Gen 2, it really should be specified on the page that this is the case.

Contributor guide

Open the contributing guide

Research direction

Start with the Amplify Gen 1 documentation referenced in the issue, then review the CLI workflow, AWS Parameter Store, and the local team-provider.json file. Document how secrets entered under Amplify hosting settings relate to Gen 1, how a webhook should access them, and whether the secrets tab is Gen 2-only.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
cloud, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
Half a day
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.