Skip to content

fix: improve Worker previews and upstream API requests - #19

Merged
imconnorngl merged 1 commit into
devfrom
fix/wrangler-preview-action
Sep 13, 2026
Merged

imconnorngl merged 1 commit into
devfrom
fix/wrangler-preview-action

Conversation

@imconnorngl

@imconnorngl imconnorngl commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Description

Worker API requests forwarded browser cookies and Cloudflare Access JWT headers to the SkyCrypt backend, which can exceed its request-header limit. The API client now forwards only the enabledPacks preference cookie from incoming requests, preserves explicitly configured API headers, sets the server API token and Lunar Client User-Agent, and disables automatic credential forwarding.

Upstream challenge pages and invalid responses now produce diagnostic HTTP errors at the API boundary. Worker deployments run before branch preview uploads so the Worker exists and its observability settings are applied.

Type of Change

  • Bug fix
  • Build/CI changes

Changes Made

  • Filter incoming API-request headers while preserving resource-pack preferences and server authentication.
  • Detect confirmed Cloudflare challenges, unexpected response types, malformed JSON, and unsuccessful API responses.
  • Include the endpoint, upstream HTTP status, content type, and Cloudflare Ray ID in errors, omitting URL credentials, query strings, and raw response bodies.
  • Preserve successful JSON response envelopes, backend error messages/statuses, and PNG image endpoints.
  • Deploy through cloudflare/wrangler-action@v3, then upload aliased and tagged previews for non-dev branches.

Testing

  • pnpm test --project server: 318 tests passed across 13 files.
  • pnpm check: zero errors and warnings.
  • ESLint and oxfmt checks for the changed files passed.
  • git diff --check passed.
  • pnpm lint stops on an existing formatting issue in unchanged CLAUDE.md.

Deployment Notes

dev uses cloudflare-production; other branches use cloudflare-development. Each GitHub environment must supply CLOUDFLARE_ENV, CLOUDFLARE_API_TOKEN, and CLOUDFLARE_ACCOUNT_ID.

@imconnorngl imconnorngl changed the title fix(ci): deploy Workers before uploading branch previews fix: improve Worker preview deployment and upstream API errors Sep 13, 2026
@imconnorngl
imconnorngl force-pushed the fix/wrangler-preview-action branch from 7285bc2 to bae2a3d Compare September 13, 2026 21:17
@imconnorngl imconnorngl changed the title fix: improve Worker preview deployment and upstream API errors fix: improve Worker previews and upstream API requests Sep 13, 2026
@imconnorngl
imconnorngl merged commit 5f6337a into dev Sep 13, 2026
12 checks passed
@imconnorngl
imconnorngl deleted the fix/wrangler-preview-action branch September 13, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants