Skip to content
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

fix incorrect Bad Gateway error code #510

Closed
thumbsupep opened this issue Oct 8, 2023 · 3 comments
Closed

fix incorrect Bad Gateway error code #510

thumbsupep opened this issue Oct 8, 2023 · 3 comments
Labels
bug Something isn't working released Has been released and published

Comments

@thumbsupep
Copy link
Contributor

graphql-ws/src/client.ts

Lines 1082 to 1097 in 4f4ac19

function isFatalInternalCloseCode(code: number): boolean {
if (
[
1000, // Normal Closure is not an erroneous close code
1001, // Going Away
1006, // Abnormal Closure
1005, // No Status Received
1012, // Service Restart
1013, // Try Again Later
1013, // Bad Gateway
].includes(code)
)
return false;
// all other internal errors are fatal
return code >= 1000 && code <= 1999;
}

Expected Behaviour
1014 is used for Bad Gateway so that Bad Gateway is not treated as a fatal error.

Actual Behaviour
1013 is considered both Try Again Later and Bad Gateway so Bad Gateway errors are incorrectly classified as fatal.

Further Information
Websocket connection close code for Bad Gateway should be 1014 https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code#value

This will be a breaking change because there might be consumers who need to update error handling to prevent a change in behavior for the 1014 close code.

I would love to contribute this change, but could only find documentation on opening an issue, not creating a PR.

@enisdenjo
Copy link
Owner

Great find! PR is more than welcome. However, I don't think this will be a breaking change.

@enisdenjo enisdenjo added the bug Something isn't working label Oct 9, 2023
@enisdenjo
Copy link
Owner

Closed with #512.

@enisdenjo
Copy link
Owner

🎉 This PR is included in version 5.14.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@enisdenjo enisdenjo added the released Has been released and published label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Has been released and published
Projects
None yet
Development

No branches or pull requests

2 participants