Environmental Variables Not Working When Deployed in Amplify

0

Locally everything works fine. When Next.js 14 app is deployed to Amplify It provisions, builds and deploys fine. But in the app, I try to access sign in, sign up (using Kinde) it does not work. Been back and forth with Kinde (callback URLs are setup correctly) it still does not work. My secret are stored in Paramater Store. I have the build settings correct. Not sure whats the problem:

version: 1 frontend: phases: preBuild: commands: - npm install --cache .npm --prefer-offline - export REACT_APP_TEST_1=$REACT_APP_TEST_1

build:
  commands:
    - npm run build
    - echo "Fetching environment variables..."
    - echo "KINDE_CLIENT_ID=$(env | grep KINDE_CLIENT_ID)" >> .env.production
    - echo "KINDE_ISSUER_URL=$(env | grep KINDE_ISSUER_URL)" >> .env.production
    - echo "KINDE_SITE_URL=$(env | grep KINDE_SITE_URL)" >> .env.production
    - echo "KINDE_POST_LOGOUT_REDIRECT_URL=$(env | grep KINDE_POST_LOGOUT_REDIRECT_URL)" >> .env.production
    - echo "KINDE_POST_LOGIN_REDIRECT_URL=$(env | grep KINDE_POST_LOGIN_REDIRECT_URL)" >> .env.production
    - echo "DATABASE_URL=$(env | grep DATABASE_URL)" >> .env.production
    - echo "DIRECT_URL=$(env | grep DIRECT_URL)" >> .env.production
    - echo "STRIPE_PRICE_ID=$(env | grep STRIPE_PRICE_ID)" >> .env.production
    - echo "PRODUCTION_URL=$(env | grep PRODUCTION_URL)" >> .env.production
    - echo "Fetching secrets from SSM..."
    - echo "KINDE_CLIENT_SECRET=$(aws ssm get-parameter --name '/amplify/dlrove54zv9py/dev/KINDE_CLIENT_SECRET' --with-decryption --query 'Parameter.Value' --output text)" >> .env.production
    - echo "STRIPE_SECRET_KEY=$(aws ssm get-parameter --name '/amplify/dlrove54zv9py/dev/STRIPE_SECRET_KEY' --with-decryption --query 'Parameter.Value' --output text)" >> .env.production
    - echo "STRIPE_WEBHOOK_SECRET=$(aws ssm get-parameter --name '/amplify/dlrove54zv9py/dev/STRIPE_WEBHOOK_SECRET' --with-decryption --query 'Parameter.Value' --output text)" >> .env.production
    - echo ".env.production configured successfully."
    

artifacts: baseDirectory: .next files: - '/*' cache: paths: - .next/cache//* - .npm/**/*

gefragt vor einem Monat76 Aufrufe
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen