-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better error message for related errors #3389
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 66f8e74 The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Apollo Federation Subgraph Compatibility Results
Learn more: |
💻 Website PreviewThe latest changes are available as preview in: https://25649a3f.graphql-yoga.pages.dev |
✅ Benchmark Results
|
d660ad3
to
56eff8c
Compare
if ( | ||
'operationName' in params && | ||
typeof params.operationName !== 'string' && | ||
params.operationName != null | ||
) { | ||
throw createGraphQLError(`Invalid operation name in the request body.`, { | ||
extensions: { | ||
http: { | ||
status: 400, | ||
}, | ||
}, | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part was missing but required in the http spec. It was caught before by chance...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we ensure we don't introduce a regression? How was this cattched by chance?
export function isValidOperationName( | ||
operationName: string | undefined, | ||
document: DocumentNode, | ||
): boolean { | ||
try { | ||
checkOperationName(operationName, document); | ||
return true; | ||
} catch { | ||
return false; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it's needed, just wanted to implement the same pattern that was used for the check of the params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this function used?
'graphql-yoga': patch | ||
--- | ||
|
||
Improve error messages in case of `operatinName` related errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the error message before?
I also don't see any new tests that ensure that the new error message is used and a regression in the future is avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comments
No description provided.