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

Invalid GID produces top-level error and erases rest of response #7346

Open
tobias-tengler opened this issue Aug 8, 2024 · 2 comments
Open
Labels
Area: Relay Issue is related to the Relay integration 🐛 bug Something isn't working 🌶️ hot chocolate

Comments

@tobias-tengler
Copy link
Collaborator

tobias-tengler commented Aug 8, 2024

Product

Hot Chocolate

Version

14.0.0-p.139

Link to minimal reproduction

#7345

Steps to reproduce

Run the test in #7345

What is expected?

I would expect the rest of the response (the unrelated field) to be present and a proper error that associates the error of the invalid Id to the field / argument where it happened:

{
 "errors": [
   {
     "message": "The node ID string has an invalid format.",
     "locations": [
       {
         "line": 2,
         "column": 8
       }
     ],
     "path": [
       "byId"
     ],
     "extensions": {
       "originalValue": "invalid"
     }
   }
 ],
 "data": {
   "byId": null,
   "unrelated": "value"
 }
}

What is actually happening?

A unassociated top-level error is raised without any data:

{
  "errors": [
    {
      "message": "The node ID string has an invalid format.",
      "extensions": {
        "originalValue": "invalid"
      }
    }
  ]
}

Relevant log output

No response

Additional context

No response

@tobias-tengler tobias-tengler added 🐛 bug Something isn't working 🌶️ hot chocolate Area: Relay Issue is related to the Relay integration labels Aug 8, 2024
@tobias-tengler
Copy link
Collaborator Author

tobias-tengler commented Aug 8, 2024

I also added another test in #7345 that showcases that the error is raised even if the field is skipped. It produces exactly the same error:

{
  "errors": [
    {
      "message": "The node ID string has an invalid format.",
      "extensions": {
        "originalValue": "invalid"
      }
    }
  ]
}

This seems veeeery unexpected.

@cliedeman
Copy link

Ran into the same issue.

Quite a slow down on tracking down errors. I also didnt' find any easy workaround to get a better error.

Wrapping the default IDSerializer throwing also results in the same behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Relay Issue is related to the Relay integration 🐛 bug Something isn't working 🌶️ hot chocolate
Projects
None yet
Development

No branches or pull requests

2 participants