Skip to content

WebSocket handlers should log unhandled errors #1122

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

Closed
Meemaw opened this issue Feb 13, 2025 · 1 comment
Closed

WebSocket handlers should log unhandled errors #1122

Meemaw opened this issue Feb 13, 2025 · 1 comment
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@Meemaw
Copy link

Meemaw commented Feb 13, 2025

Was looking at the code, and it seems WebSocket original exception that happen when mapping the payload to gql message are "swallowed". On client, we just see a generic: Subscription error. This makes it almost impossible to debug, but also notice issues with messages.

Looking at the code, this seems to happen here:

https://github.com/spring-projects/spring-graphql/blob/main/spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlWebSocketHandler.java#L350

There should be an option to log an error here, this is an uncaught exception basically.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 13, 2025
@rstoyanchev rstoyanchev self-assigned this Feb 17, 2025
@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 17, 2025
@rstoyanchev rstoyanchev added this to the 1.3.4 milestone Feb 17, 2025
@rstoyanchev
Copy link
Contributor

Indeed we should be logging an unresolved exception at that point. We'll fix that. Note that you can handle subscription exceptions, or if it is a controller method, you can also use an @GraphQlExceptionHandler method.

@rstoyanchev rstoyanchev changed the title WebSocket errors swallowed WebSocket handlers should log unhandled errors Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants