I'm working on migrating my project from spring boot 3.5.11 to 4.0.3 and I've come across an issue with interceptors and websockets. My application works properly on version 3.5.11, but fails when stepping up to 4.0.3. I've created a minimal example project to demonstrate the issue which I'll link here.
https://github.com/tstocker-black-cape/spring-graphql-websocket-bug-example
It's possible that something has changed between versions and I'm now doing something wrong, but I'm able to recreate the issue in the example.
When attempting to call a subscription endpoint backed by a websocket, the call closes with code 1011 and the server responds with
{
"errors": [
{
"message": "Unknown GraphQL error"
}
]
}
In the server, an exception is thrown
java.lang.IllegalStateException: The request object has been recycled and is no longer associated with this facade
at org.apache.catalina.connector.RequestFacade.checkFacade(RequestFacade.java:609)
at org.apache.catalina.connector.RequestFacade.getHeader(RequestFacade.java:287)
at jakarta.servlet.http.HttpServletRequestWrapper.getHeader(HttpServletRequestWrapper.java:82)
at org.springframework.security.web.firewall.StrictHttpFirewall$StrictFirewalledRequest.getHeader(StrictHttpFirewall.java:724)
at jakarta.servlet.http.HttpServletRequestWrapper.getHeader(HttpServletRequestWrapper.java:82)
at jakarta.servlet.http.HttpServletRequestWrapper.getHeader(HttpServletRequestWrapper.java:82)
at org.springframework.http.server.ServletRequestHeadersAdapter.getFirst(ServletRequestHeadersAdapter.java:59)
at org.springframework.http.server.ServletRequestHeadersAdapter.getFirst(ServletRequestHeadersAdapter.java:47)
at org.springframework.http.server.ServletRequestHeadersAdapter$RequestHeaderOverrideWrapper.getFirst(ServletRequestHeadersAdapter.java:266)
at org.springframework.http.server.ServletRequestHeadersAdapter$RequestHeaderOverrideWrapper.getFirst(ServletRequestHeadersAdapter.java:253)
at org.springframework.http.HttpHeaders.getFirst(HttpHeaders.java:1784)
...
I'm working on migrating my project from spring boot 3.5.11 to 4.0.3 and I've come across an issue with interceptors and websockets. My application works properly on version 3.5.11, but fails when stepping up to 4.0.3. I've created a minimal example project to demonstrate the issue which I'll link here.
https://github.com/tstocker-black-cape/spring-graphql-websocket-bug-example
It's possible that something has changed between versions and I'm now doing something wrong, but I'm able to recreate the issue in the example.
When attempting to call a subscription endpoint backed by a websocket, the call closes with code
1011and the server responds withIn the server, an exception is thrown