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
graphql responses are now http 200 (fix #1368) #2064
Conversation
All graphql clients expect responses to be HTTP 200. Non-200 responses are considered transport layer errors. Changed all graphql responses in **/v1/graphql** endpoint to be 200. TODO: run tests for both endpoints
Review app for commit 2e194ac deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
- run all graphql tests on /v1/graphql and /v1alpha1/graphql
Deploy preview for hasura-docs ready! Built with commit 246ff07 |
Review app for commit 7507cf2 deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
Review app for commit 8c34961 deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
Review app for commit 9f1e04c deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
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.
LGTM
@ecthiender Can you check the error response format for subscriptions for
|
@0x777 You're right, subscription errors are not GraphQL compliant. {
"type": "error",
"id": "1",
"payload": {
"path": "$.selectionSet.articles.selectionSet.id1",
"error": "field \"id1\" not found in type: 'articles'",
"code": "validation-failed"
}
} is what the response is right now. It should be: {
"type": "error",
"id": "1",
"payload": {
"message": "field \"id1\" not found in type: 'articles'",
"extensions": {
"code": "validation-failed",
"path": "$.selectionSet.articles.selectionSet.id1"
}
}
} Need to run some more tests to confirm the behaviour. |
Review app for commit 1db897a deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
Review app for commit d80356b deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
Review app for commit 979dc2d deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
- /v1alpha1/graphql returns older response structure - /v1/graphql returns newer response structure
Review app for commit 41e581c deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
- run all tests only for v1/graphql - run specific tests for v1alpha1/graphql to check error response structures
Review app for commit 1531ed9 deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
@@ -155,8 +163,17 @@ onConn (L.Logger logger) corsPolicy wsId requestHead = do | |||
(BL.toStrict $ J.encode $ encodeGQLErr False qErr) | |||
|
|||
checkPath = |
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.
checkPath
should return ErrRespType
. You don't have to look at paths twice.
Review app for commit eedc41f deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
Review app for commit bd16413 deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
Review app for commit 246ff07 deployed to Heroku: https://hge-ci-pull-2064.herokuapp.com |
Review app https://hge-ci-pull-2064.herokuapp.com is deleted |
Changes compared to `/v1alpha1/graphql` * Changed all graphql responses in **/v1/graphql** endpoint to be 200. All graphql clients expect responses to be HTTP 200. Non-200 responses are considered transport layer errors. * Errors in http and websocket layer are now consistent and have similar structure.
All graphql clients expect responses to be HTTP 200. Non-200 responses are considered transport layer errors. Changed all graphql responses in
/v1/graphql
endpoint to be 200.Description
This change only works on the new endpoint:
/v1/graphql
. The behaviour of/v1alpha1/graphql
remains the same.Affected components
Related Issues
#1368
Solution and Design
Steps to test and verify
/v1/graphql
endpointLimitations, known bugs & workarounds
Console changes are pending.
Have select tests for
/v1alpha1/graphql
over websocket