-
Notifications
You must be signed in to change notification settings - Fork 575
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
log unexpected errors in the server console by default #1584
Comments
Hey @qsona, thank you for using GraphQL Yoga! Currently, errors are not logged to the console. The original error SHOULD be included within the errors HOWEVER, there is currently a bug within envelop that causes the error message to be swallowed. I am working on a fix of that here: Let's track this here instead and keep this issue as a general logging issue: #1585 For now, you can use the following workaround, by specifying your own logger plugin: https://codesandbox.io/s/yoga-log-unexpected-errors-to-the-console-vhir52 We are currently working on GraphQL Yoga v3 (see our roadmap #1358). We want to make sure that Yoga v3 has the best developer experience. Logging unexpected errors to the console seems like something we should probably do. In which kind of format would you expect these logs? |
@n1ru4l Sorry my report was a bit inaccurate. The workaround you showed (
I don't have a strong opinion about log format, but I'm basically satisfied with current way, I mean |
I have a similar problem, where e.g. errors thrown in any callback supplied to plugins loses their stack traces and can be very tedious to track down.
It would be great if such errors somehow could be logged, maybe using the debug library. |
I am currently having issues writing error handling with yoga v3. In v3 the errors that I throw seems lost. I have been trying to figgure out when the my error is converted to a GraphQLErorr and the original error lost. I understand that "maskError" happens after Within "maskError" the error has already been converted to a GraphQLerror
Using the I am using I am sure the answer is simple, but I think it should be documented how one should catch a custom error thrown in resolvers. Edit: After reading up on the documentation, i see that this is intentional. I understand the design, and I have to rewrite our error handling to support v3. Which is fine. I did however like the idea of throwing my custom erros from my resolver integrations and having a single place to catch them all. Explicit is however better than implicit, so I just have to move my code around. |
Describe the bug
When an error thrown from
context
function, no error logs are shown in standard output/error.Implementation:
Then I open the GraphiQL page, the response is
but no error logs are shown up, so it's hard to find the cause.
I tried
useLogger()
anduseErrorHandler()
plugins but both didn't catch that error.Your Example Website or App
https://codesandbox.io/s/summer-brook-tvigl0?file=/src/main.ts
Steps to Reproduce the Bug or Issue
context
value as a function that throws an errorExpected behavior
As a developer, I expected the error messages are shown.
Screenshots or Videos
No response
Platform
@graphql-yoga/*
version(s): 2.5.0, 2.13.6Additional context
Sorry, I haven't investigate whether this problem is related graphql-yoga or envelop.
The text was updated successfully, but these errors were encountered: