Skip to content

Commit 0306f49

Browse files
Uttam-Mahataclaude
andcommitted
fix: use --env-vars-file to avoid comma/URL parsing issues in gcloud
--set-env-vars chokes on commas inside CORS_ALLOWED_ORIGINS value. Switched to --env-vars-file with a YAML file written at deploy time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bb14e17 commit 0306f49

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/backend-deploy-gcf.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ jobs:
4242
artifactregistry.googleapis.com \
4343
--project=rootaccessctf
4444
45+
- name: Write env-vars file
46+
run: |
47+
cat > /tmp/gcf-env.yaml <<'EOF'
48+
APP_ENV: "production"
49+
PORT: "8080"
50+
TRUSTED_PROXIES: "*"
51+
AWS_SSM_PATH: "/RootAccess/Backend"
52+
AWS_REGION: "us-east-1"
53+
CORS_ALLOWED_ORIGINS: "https://rootaccessctf.web.app,https://rootaccess.live,https://ctf.rootaccess.live"
54+
EOF
55+
4556
- name: Deploy Cloud Function
4657
run: |
4758
gcloud functions deploy rootaccess-api \
@@ -57,7 +68,7 @@ jobs:
5768
--timeout=60s \
5869
--min-instances=0 \
5970
--max-instances=10 \
60-
--set-env-vars="APP_ENV=production,PORT=8080,TRUSTED_PROXIES=*,AWS_SSM_PATH=/RootAccess/Backend,AWS_REGION=us-east-1,CORS_ALLOWED_ORIGINS=https://rootaccessctf.web.app,https://rootaccess.live,https://ctf.rootaccess.live" \
71+
--env-vars-file=/tmp/gcf-env.yaml \
6172
--set-secrets="AWS_ACCESS_KEY_ID=gcf-aws-access-key-id:latest,AWS_SECRET_ACCESS_KEY=gcf-aws-secret-access-key:latest"
6273
6374
- name: Get GCF URL

0 commit comments

Comments
 (0)