apollographql / apollo-server

🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
https://www.apollographql.com/docs/apollo-server/
MIT License
13.76k stars 2.03k forks source link

Insconsistent response when error is thrown at `parseLiteral` vs within resolver #4449

Closed grillorafael closed 1 year ago

grillorafael commented 4 years ago

Dependencies:

    "@apollo/federation": "0.19.0",
    "@apollo/gateway": "0.19.0",
    "apollo-server": "2.9.7",

https://codesandbox.io/s/trusting-bardeen-48xv5?file=/index.js

Codesandbox doesn't work but the code works locally.

Scenarios:

  1. Throwing error in resolver
    {
    hello
    }

response:

image

  1. Throwing in parseLiteral
    
    mutation {
    myMutation(input: 2123)
    }

![image](https://user-images.githubusercontent.com/1812267/89229170-dae03380-d5d8-11ea-8a6e-dab53aada75c.png)

My expectation was to not see the extra `errors` key
glasser commented 1 year ago

Error normalized has been simplified a bunch in Apollo Server 4. As you mentioned, your codesandbox doesn't actually work, so I wasn't able to try to upgrade it to AS4. If this is still an issue in AS4, please share an updated reproduction and we'll look into it! Sorry for the delay.