Comments (6)
Thanks for reporting. We'll look into it. The examples do need some updates so will fix those and post an update.
from dgs-framework.
I think, I have a follow up issue. But it may just be connected to my workaround providing my own ObjectMapper to dgs.
If I want to test a simple subscription, I get this errror
ExceptionWebSocketHandlerDecorator - Closing session due to exception for StandardWebSocketSession[id=0abecb5b-e29e-64be-ba95-40e723869dfa, uri=ws://localhost:8080/subscriptions?token=TOKEN] - tryCloseWithError
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.netflix.graphql.types.subscription.websockets.Message$SubscribeMessage` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (String)"{"id":"ebc576a5-3d3d-48fc-8c59-271bbf62904f","type":"subscribe","payload":{"variables":{},"extensions":{},"operationName":"test","query":"subscription test {\n test\n}"}}"; line: 1, column: 53]
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1915)
at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:414)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1360)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1434)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:352)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:220)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:187)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:170)
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:136)
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:263)
at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:74)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3740)
at com.netflix.graphql.dgs.subscriptions.websockets.WebsocketGraphQLTransportWSProtocolHandler.handleTextMessage(WebsocketGraphQLTransportWSProtocolHandler.kt:109)
at com.netflix.graphql.dgs.subscriptions.websockets.DgsWebSocketHandler.handleTextMessage(DgsWebSocketHandler.kt:109)
at org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43)
at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75)
at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:56)
at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.handleMessage(ExceptionWebSocketHandlerDecorator.java:58)
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:113)
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:84)
at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:81)
at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:390)
at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:130)
at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:484)
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:284)
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:130)
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:85)
at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:184)
at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:164)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:152)
at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:57)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
at java.base/java.lang.Thread.run(Thread.java:840)
from dgs-framework.
So actually one thing that needs to be called out here is the usage of implementation("com.netflix.graphql.dgs:graphql-dgs-subscriptions-websockets-autoconfigure")
that needs to be replaced by implementation("org.springframework.boot:spring-boot-starter-websocket")
With the spring-graphql integration, we rely on spring-graphql's implementation of websocket based subscriptions and therefore the DGS module won't work here. This will eliminate the need to provide a dgsObjectMapper as well.
Similarly, for multipart file uploads we need to explicitly add implementation("name.nkonev.multipart-spring-graphql:multipart-spring-graphql:1.1.4
instead of relying on the framework's implementation.
I will update our docs to reflect the websocket part.
from dgs-framework.
ok thanks. I will wait for the documentation update.
Replacing implementation("com.netflix.graphql.dgs:graphql-dgs-subscriptions-websockets-autoconfigure")
with implementation("org.springframework.boot:spring-boot-starter-websocket")
does not work for me. Maybe I am just missing some configuration now
WARN o.s.web.servlet.PageNotFound - No mapping for GET /subscriptions - noHandlerFound
WARN o.s.web.servlet.PageNotFound - No endpoint GET /subscriptions. - handleNoHandlerFoundException
from dgs-framework.
Yes it does as documented here: https://github.com/spring-projects/spring-graphql/blob/1.0.x/samples/webflux-websocket/src/main/resources/application.properties#L1
You need to add spring.graphql.websocket.path: /graphql
I will add this to the docs.
from dgs-framework.
Thanks for helping me out. I wasn't familiar with the spring graphql setup process.
The GraphQL WebSocket endpoint is off by default. To enable it:
- For a Servlet application, add the WebSocket starter spring-boot-starter-websocket
- For a WebFlux application, no additional dependency is required
- For both, the spring.graphql.websocket.path application property must be set
from dgs-framework.
Related Issues (20)
- feature: Allow specifying custom scalars when generating queries using Kotlin query projections HOT 11
- bug: webRequest.getResponse() is null HOT 5
- bug: CORS errors in frontend app only after updating to v6 (with SpringBoot 3) HOT 1
- Scalar backed by value class inside input type fail to deserialize HOT 3
- bug: unmapped fields after version upgrade when using dgs.graphql.schema-locations HOT 5
- bug: Deadlock after upgrading to DGS 7.6.0 version HOT 7
- bug: dgsMicrometerContextRegistry's Slf4jThreadLocalAccessor conflicts with ObservationThreadLocalAccessor HOT 5
- bug: Switching to `graphql-dgs-spring-graphql-starter` breaks `Upload` GraphQL scalar HOT 3
- documentation: Incorrect Information in DGS Framework Documentation Regarding WebSocket Sub-Protocols HOT 2
- bug: unmapped fields after switching to Spring GraphQL integration HOT 5
- bug: "path" is not mapped from DataFetchingException to TypedGraphQLError HOT 1
- bug: scalar coercing exceptions don't use typed graphql error HOT 8
- bug: XML Injection (AKA Blind Xpath Injection) in ORG.XMLUNIT:XMLUNIT-CORE [CVE-2024-31573] HOT 1
- bug: Java Optional<> - Failed to convert from type LinkedHasMap<?, ?> to type HOT 4
- bug: OpenTelemetry Context is not getting propagated in the data loader HOT 5
- bug: dgs.graphql.path is not working in 8.7.1 & 9.0.0 versions with spring integration HOT 3
- bug: GraphQLJavaErrorInstrumentation changes error type of DataFetchingException HOT 3
- bug: Optional null fields are not returned HOT 5
- bug: DgsSpringGraphQLAutoConfiguration not compatible with WebFluxHateoasConfiguration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgs-framework.