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

When the server returns an error with an empty string message, GraphQLError.message becomes an object instead of a string #3649

Closed
3 tasks done
koutaro-masaki opened this issue Aug 5, 2024 · 0 comments · Fixed by #3650

Comments

@koutaro-masaki
Copy link

Describe the bug

react code

If the server returns an non-empty string as message

スクリーンショット 2024-08-05 14 47 03

Response
スクリーンショット 2024-08-05 14 47 29

CombinedError
スクリーンショット 2024-08-05 14 46 49

If the server returns an empty string as message

server throws error

Response
スクリーンショット 2024-08-05 14 45 29

CombinedError
スクリーンショット 2024-08-05 14 45 05

It is likely an issue with the condition within rehydrateGraphQlError. When error.message is an empty string, error.message is falsy, leading to return new GraphQLError(error as any) even though error has the structure of a GraphQLError.

Reproduction

https://github.com/koutaro-masaki/urql-issue-reproduction

Urql version

urql v4.1.0

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant