Skip to content

fix: correct GraphQL path detection in code executor - #24

Merged
mattzcarey merged 1 commit into
mainfrom
fix/graphql-path-routing
Feb 20, 2026
Merged

fix: correct GraphQL path detection in code executor#24
mattzcarey merged 1 commit into
mainfrom
fix/graphql-path-routing

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The GraphQL endpoint detection in the code executor checked for /client/v4/graphql, but user-supplied paths are relative to the API base which already includes /client/v4
  • A user calling cloudflare.request({ path: '/graphql', ... }) would never match the old check, causing GraphQL responses to be parsed as REST and throwing misleading errors like "GraphQL error: No route for that URI"
  • Changed the check to match /graphql directly

Test plan

  • Verify cloudflare.request({ method: 'POST', path: '/graphql', body: { query: '{ viewer { accounts { accountTag } } }' } }) returns GraphQL-formatted responses
  • Verify REST endpoints still work as before

The GraphQL endpoint check compared against '/client/v4/graphql' but user-supplied paths are relative to the API base (which already includes /client/v4), so the path would just be '/graphql'. This caused GraphQL responses to be handled as REST responses, throwing misleading errors.
@mattzcarey
mattzcarey force-pushed the fix/graphql-path-routing branch from ecc6596 to a232140 Compare February 20, 2026 00:02
@mattzcarey
mattzcarey merged commit 61e7f4b into main Feb 20, 2026
1 check passed
@mattzcarey
mattzcarey deleted the fix/graphql-path-routing branch February 20, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant