Repository navigation
fix(graphql): reject malformed SDK query envelopes - #13605
Merged
Merged
Conversation
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
`execute()` keeps its `array` signature; the two POST endpoints reject a non-array `query` envelope before execution, which is the only place a non-array can arise since `getParams()` always returns an array. Trim the new assertions to the behaviour each test is named for.
A string or scalar SDK `query` envelope now points the caller at
`{"query": "...", "variables": {}}`, the object shape the endpoint accepts.
ChiragAgg5k
approved these changes
Sep 11, 2026
2 of 4 tasks
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.
What does this PR do?
Return HTTP 400 instead of 500 when a GraphQL SDK request (
x-sdk-graphql: true) contains an invalid query envelope. Both POST endpoints validate the unwrapped value before execution:queryreturnsgeneral_argument_invalid, with a message showing the accepted shape{"query": "...", "variables": {}}{}or[]queryreturns the existinggraphql_no_queryFixes CLOUD-3QWQ.
The string envelope comes from the JS SDKs: the documented
graphql.query({ query, variables })call is read as the SDK's params-object overload and sent as{"query":"<document>"}without its variables. appwrite/sdk-generator#1897 fixes the SDKs. The server keeps rejecting the flat body instead of running it, because the variables are already gone and nullable ones would silently run as null.Test Plan
/v1/graphqland/v1/graphql/mutationfor string,{}and missing envelopes on main; each returns 400 on this branch.test tests/e2e/Services/GraphQL/ContentTypeTest.php tests/e2e/Services/GraphQL/BatchTest.php: 39 tests, 182 assertions passed.