fix: set Pages Function API_URL via Cloudflare API before deployment#25
Merged
pkmaster21 merged 1 commit intomainfrom Apr 16, 2026
Merged
fix: set Pages Function API_URL via Cloudflare API before deployment#25pkmaster21 merged 1 commit intomainfrom
pkmaster21 merged 1 commit intomainfrom
Conversation
The env: key in the wrangler-action step only sets shell environment variables for the wrangler process — it does not configure Cloudflare Pages Function runtime environment variables. Added an explicit PATCH call to the Cloudflare Pages API to set API_URL before deploying, so the proxy function correctly resolves the upstream API Gateway URL.
Deploying tabby with
|
| Latest commit: |
e29b0bb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c61c2618.tabby.pages.dev |
| Branch Preview URL: | https://fix-pages-api-url-env.tabby.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
env: API_URL:key in the wrangler-action step only sets a shell environment variable for the wrangler process — it has no effect on the Cloudflare Pages Function's runtime environment. As a result,env.API_URLinside the Function was either undefined (returning 502) or stale from a previous dashboard setting, causing the proxy to fail.Fix
Added a
curlstep before deployment that PATCHes the Cloudflare Pages project via the API to setAPI_URLas a production environment variable. This ensures the correct API Gateway URL is always in sync with thePROD_API_GATEWAY_URLsecret before each deployment.The no-op
env: API_URL:on the wrangler-action step has been removed.