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

Accessing Secrets in Amplify Gen 1 App

Open sph94 opened this issue 1 year ago • 1 comments

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.

sph94 avatar Jun 27 '24 14:06 sph94