You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deployment to production is successful, but I'm having some issues passing a parameter value from AWS SSM to a env file, it's undefined no matter what I do. Thus, my useAsyncData is returning an error.
Here are my codes for the amplify.yml file as well as the runtimeConfig object on my nuxt.config.ts file. Only config.githubSecret is undefined, the public githubBaseUrl is working.
Is AWS SSM not supported for deploying to production? Must I set the environment variables under the build settings on the AWS Amplify console?
nitro: {preset: "aws-amplify"},runtimeConfig: {/// Tried with githubSecret: "", not working as wellgithubSecret: process.env.NUXT_GITHUB_SECRET,public: {githubBaseUrl: "https://api.github.com",},},
HI, what was the solution? Currently having similar issues getting .env variables into AWS Amplify site. It looks like you've just manually added them to the amplify.yml to get them in there, but this is not mentioned in the Nuxt docs that I can see? thanks
whereas if you're getting multiple parameters, it's much better to use aws ssm get-parameters for better optimization.
preBuild:
commands:
# Required to install jq as an admin user with the following command
- sudo yum install -y jq
build:
commands:
- PARAMETERS=$(aws ssm get-parameters --names /amplify/ssm1 /amplify/ssm2 --with-decryption --query "Parameters[*].{Name:Name,Value:Value}")
- export NUXT_SSM1=$(echo $PARAMETERS | jq -r '.[] | select(.Name=="/amplify/ssm1").Value')
- export NUXT_SSM2=$(echo $PARAMETERS | jq -r '.[] | select(.Name=="/amplify/ssm2").Value')
- |
cat <<EOF >> .env
NUXT_SSM1=$NUXT_SSM1
NUXT_SSM2=$NUXT_SSM2
EOF
- pnpm run build
Edit: If you're not using AWS SSM to store your secrets, the alternative way is to include them in the environments tab under Amplify hosting. Albeit, I have not tried this method as I believe using AWS SSM is more secured
Environment
Production
Reproduction
No reproduction is required.
Describe the bug
Deployment to production is successful, but I'm having some issues passing a parameter value from AWS SSM to a env file, it's
undefined
no matter what I do. Thus, my useAsyncData is returning an error.Here are my codes for the
amplify.yml
file as well as the runtimeConfig object on mynuxt.config.ts
file. Onlyconfig.githubSecret
is undefined, the publicgithubBaseUrl
is working.Is AWS SSM not supported for deploying to production? Must I set the environment variables under the build settings on the AWS Amplify console?
Thanks in advance.
amplify.yml
nuxt.config.ts
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: