-
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
[jwt] fix unauthorized being thrown in onRequest
#3149
Conversation
🦋 Changeset detectedLatest commit: 8f302c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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://e3ca9496.graphql-yoga.pages.dev |
✅ Benchmark Results
|
Hi @EmrysMyrddin, amazing work here. I made the |
You're welcome 😃 I'm justing waiting for the CI and will release it 😃 Should be available in a few minutes |
Now available in version 2.1.1 :-) |
Description
The JWT plugin was parsing and checking the jwt token in the
onRequest
hook. The implementation was simply throwing an error when not authenticated or on bad jwt token. The problem is that errors thrown inonRequest
hook are not handled by yoga and are bubling up directly to the actual HTTP server implementation.When using
express
,koa
orfastify
, this was resulting in a response with500
status code.When using Node's http server, this was resulting in simply crashing the server.
To fix this, we should always using
onRequestParse
overonRequest
.fixes #3147