From 31609d1bf3c2dd1788efbba98b10376b17a2c00b Mon Sep 17 00:00:00 2001 From: GianM Date: Mon, 26 Jan 2026 14:54:11 +0700 Subject: [PATCH 1/6] Update example for RELAYER_WALLET_KEY From 0c9d7599a2ea73e6c0077f45a41ee265d0b966e4 Mon Sep 17 00:00:00 2001 From: GianM Date: Mon, 26 Jan 2026 14:55:17 +0700 Subject: [PATCH 2/6] Add branch 'gianalarcon-patch-3' to CI workflow --- .github/workflows/backend-ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index b1fa882..4f7e122 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -4,6 +4,7 @@ on: push: branches: - "main" + - "gianalarcon-patch-3" paths: - "packages/backend/**" - "packages/shared/**" From 658570320092a9989376653d0dc9e86f14eddfcf Mon Sep 17 00:00:00 2001 From: gianmalarcon Date: Mon, 26 Jan 2026 16:37:33 +0700 Subject: [PATCH 3/6] Fix Cloud Run port binding by reading PORT env var Cloud Run injects PORT, not BACKEND_PORT. The app now checks PORT first (for Cloud Run), then falls back to BACKEND_PORT (for local dev), with 4000 as the default. Co-Authored-By: Claude Opus 4.5 --- packages/backend/src/config/app.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/config/app.config.ts b/packages/backend/src/config/app.config.ts index 072bdd9..573c0bc 100644 --- a/packages/backend/src/config/app.config.ts +++ b/packages/backend/src/config/app.config.ts @@ -1,7 +1,7 @@ import { registerAs } from '@nestjs/config'; export default registerAs('app', () => ({ - port: parseInt(process.env.BACKEND_PORT) || 4000, + port: parseInt(process.env.PORT || process.env.BACKEND_PORT) || 4000, nodeEnv: process.env.NODE_ENV || 'development', // CORS configuration for frontend corsOrigin: process.env.CORS_ORIGIN || 'http://localhost:3000', From 5f04e6a5d90462f94457457e278325244f9c693b Mon Sep 17 00:00:00 2001 From: gianmalarcon Date: Mon, 26 Jan 2026 16:49:26 +0700 Subject: [PATCH 4/6] Add required env vars to Cloud Run deployment Pass RELAYER_ZKVERIFY_API_KEY and RELAYER_WALLET_KEY from GitHub secrets to Cloud Run. These are required by the backend config validation and were causing startup failures. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/backend-ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index 4f7e122..f4bb329 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -54,9 +54,12 @@ jobs: GCP_REPOSITORY: ${{ vars.GCP_REPOSITORY }} GCP_IMAGE: ${{ vars.GCP_BACKEND_NAME }} CLOUD_RUN_SERVICE: polypay-backend + RELAYER_ZKVERIFY_API_KEY: ${{ secrets.RELAYER_ZKVERIFY_API_KEY }} + RELAYER_WALLET_KEY: ${{ secrets.RELAYER_WALLET_KEY }} run: | gcloud run deploy ${CLOUD_RUN_SERVICE} \ --image ${GCP_LOCATION}-docker.pkg.dev/${GCP_PROJECT_ID}/${GCP_REPOSITORY}/${GCP_IMAGE}:${GITHUB_SHA} \ --region ${GCP_LOCATION} \ --platform managed \ - --allow-unauthenticated + --allow-unauthenticated \ + --set-env-vars "RELAYER_ZKVERIFY_API_KEY=${RELAYER_ZKVERIFY_API_KEY},RELAYER_WALLET_KEY=${RELAYER_WALLET_KEY}" From 9bdfd6f8099f84a7ddb5550150cd701fd9bdcbd9 Mon Sep 17 00:00:00 2001 From: gianmalarcon Date: Mon, 26 Jan 2026 17:09:23 +0700 Subject: [PATCH 5/6] Add CORS_ORIGIN for production domain Set CORS_ORIGIN to https://app.polypay.pro to allow requests from the production frontend. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/backend-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index f4bb329..27afb76 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -62,4 +62,4 @@ jobs: --region ${GCP_LOCATION} \ --platform managed \ --allow-unauthenticated \ - --set-env-vars "RELAYER_ZKVERIFY_API_KEY=${RELAYER_ZKVERIFY_API_KEY},RELAYER_WALLET_KEY=${RELAYER_WALLET_KEY}" + --set-env-vars "RELAYER_ZKVERIFY_API_KEY=${RELAYER_ZKVERIFY_API_KEY},RELAYER_WALLET_KEY=${RELAYER_WALLET_KEY},CORS_ORIGIN=https://app.polypay.pro" From af0fe71057a94e349b110dc2ee42d6e55d3317de Mon Sep 17 00:00:00 2001 From: gianmalarcon Date: Mon, 26 Jan 2026 17:29:13 +0700 Subject: [PATCH 6/6] Use update-env-vars to preserve existing Cloud Run env vars Changed from --set-env-vars to --update-env-vars so deployments don't overwrite env vars like DATABASE_URL that are configured directly on Cloud Run. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/backend-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index 27afb76..d19c902 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -62,4 +62,4 @@ jobs: --region ${GCP_LOCATION} \ --platform managed \ --allow-unauthenticated \ - --set-env-vars "RELAYER_ZKVERIFY_API_KEY=${RELAYER_ZKVERIFY_API_KEY},RELAYER_WALLET_KEY=${RELAYER_WALLET_KEY},CORS_ORIGIN=https://app.polypay.pro" + --update-env-vars "RELAYER_ZKVERIFY_API_KEY=${RELAYER_ZKVERIFY_API_KEY},RELAYER_WALLET_KEY=${RELAYER_WALLET_KEY},CORS_ORIGIN=https://app.polypay.pro"