-
-
Notifications
You must be signed in to change notification settings - Fork 452
Replies: 1 comment · 8 replies
-
I have the same issue. can you fix it? |
Beta Was this translation helpful? Give feedback.
All reactions
-
Just double-checked with the linked example above. You're correct 👍 |
Beta Was this translation helpful? Give feedback.
All reactions
-
@kitten, thank you for sharing the example. After reviewing it, I've noticed that the setup is quite straightforward and doesn't significantly differ from mine. The main difference seems to be that the example utilizes a plain Yoga server setup (createServer then listen), whereas my configuration involves a Nitro server with Yoga (createYoga then fromNodeMiddleware). This has led me to wonder about the compatibility and functionality of fetchSubscription within different server setups. Specifically, I'm trying to understand why the example's fetchSubscription approach works seamlessly with a Yoga server, and whether fetchSubscription can be utilized alongside SubscriptionExchange, or if it's a choice between using one or the other. Could you provide some insights or guidance on making fetchSubscription work with a Nitro server setup as I'm currently using? Here is the full error when using chunk-WYHMRHZK.js?v=5b0da496:1805 Uncaught (in promise) DOMException: BodyStreamBuffer was aborted
at http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:1805:10
at http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:785:13
at http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:1007:13
at Array.<anonymous> (http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:676:9)
at http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:849:19
at next (http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:1164:11)
at Object.next (http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:1193:9)
at nextOperation (http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:2372:10)
at http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:2418:9
at http://localhost:3000/_nuxt/@fs/home/kyle/project/node_modules/.cache/vite/client/deps/chunk-WYHMRHZK.js?v=5b0da496:785:13
``` |
Beta Was this translation helpful? Give feedback.
All reactions
-
You could also try this: http://npm.im/@graphql-yoga/plugin-graphql-sse As per the middleware, I'm not sure what that setup looks like. As long as it's supported by the GraphQL Yoga team, maybe you could ask them what's going on? I'd also do a quick test with curl, just to see whether it's working for sure once that's set up: https://the-guild.dev/graphql/yoga-server/docs/features/subscriptions |
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
@kitten Thanks for the suggestion regarding SSE. Upon revisiting the documentation, I realized that there are different types of subscriptions available: SSE and WS. Initially, I attempted to implement a WebSocket (WS) subscription and encountered difficulties, the specifics of which were unclear. This approach involved the After some trial and error, I decided to switch to using Server-Sent Events (SSE) and was successful in setting it up. Here's an overview of the changes I made to my setup, moving away from WebSocket (WS) to Server-Sent Events (SSE): Client-side setup: // Initially tried using WebSocket via graphql-ws, but switched to SSE.
// import { createClient as createWSClient } from 'graphql-ws';
import { createClient as createSSEClient } from 'graphql-sse';
const wsClient = createSSEClient({
url: 'http://example.com/api/graphql',
});
...
subscriptionExchange({
forwardSubscription(request) {
const operation = { ...request, query: request.query || '' };
return {
subscribe(sink) {
const unsubscribe = wsClient.subscribe(operation, sink);
return { unsubscribe };
},
};
}
}); Server-side setup: import { useGraphQLSSE } from '@graphql-yoga/plugin-graphql-sse';
...
plugins: [useGraphQLSSE()] This shift to SSE resolved the issues I was facing with WS. I'm curious about the technical differences and limitations between WS and SSE in this context, especially concerning |
Beta Was this translation helpful? Give feedback.
All reactions
-
Yea, just to point this out, using the GraphQL SSE client package shouldn't be necessary. I wouldn't be able to tell you why the Again, not sure how you're setting up your API apart from this, but that's something to watch out for in general |
Beta Was this translation helpful? Give feedback.
-
I don't understand what to handle this error could it be a bug?
the error appears when I change pages in the application
Beta Was this translation helpful? Give feedback.
All reactions