-
Notifications
You must be signed in to change notification settings - Fork 574
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
Test not executing code inside subscription callback when using GraphQL Yoga #3245
Comments
I'm also interested in an onConnect callback. If there's already a callback for this, or if you know of a workaround, please share it here. |
Adding the two lines below resolves the issues I mentioned on the description:
However, these approaches have drawbacks that make them unsuitable for my requirements. None of these issues happened when using Apollo Server + Apollo Link. |
Additionally, I observed that if, instead of adding |
Regarding the second issue (the test process doesn't finish properly) If I add the following to the end of the test: import whyIsNodeRunning from 'why-is-node-running';
...
...
...
setTimeout(() => {
console.log(whyIsNodeRunning());
}, 1000); I get the following: $ node src/test.js
All tests passed!
Test completed
There are 6 handle(s) keeping the process running
# TCPWRAP
C:\www\yoga-issue\node_modules\@whatwg-node\node-fetch\cjs\fetchNodeHttp.js:33 - const nodeRequest = requestFn(fetchRequ
est.url, {
# DNSCHANNEL
(unknown stack trace)
# HTTPCLIENTREQUEST
(unknown stack trace)
# TTYWRAP
C:\www\yoga-issue\node_modules\@whatwg-node\node-fetch\cjs\fetchNodeHttp.js:74 - responseBody = nodeResponse.pipe(new stream_1.PassThrough());
# TTYWRAP
C:\www\yoga-issue\node_modules\@whatwg-node\node-fetch\cjs\fetchNodeHttp.js:74 - responseBody = nodeResponse.pipe(new stream_1.PassThrough());
# Timeout
(unknown stack trace)
undefined |
Describe the bug
I have a very simple dummy server with: Node.js + GraphQL + Apollo Server & Link that I'm migrating to Yoga Server & Link.
The Yoga version uses the same logic / idea as the Apollo version, just changed the necessary things.
You have the project repo here: https://github.com/zeuscronos/yoga-issue
On commit: "apollo server + test" you have the Apollo version while on commit: "yoga server + test" you have the Yoga version.
The Apollo version works as expected, i.e.:
In the other hand, the Yoga version has issues:
Additionally - Proposal
I would recommend the
YogaLink
to have an option to set anonConnected
callback similarly to what it is on the line below. That may be needed in some scenarios where we need to wait for the WS connection to be stablished before doing other operations:zeuscronos/yoga-issue@bcd0bd3#diff-c7000107e5c2a5b190270c14f474e8538f6af25f052c8290bc0c3cddc2714c6aR86
Your Example Website or App
Apollo Server + Test
https://stackblitz.com/edit/github-hhdwqx-rk8lne?file=src%2Findex.js,src%2Ftest.js
All good with Apollo Server + Apollo Link...
Yoga Server + Test
https://stackblitz.com/edit/github-hhdwqx-owkeze?file=src%2Findex.js,src%2Ftest.js
Hanging when using Yoga Server + Yoga Link...
Steps to Reproduce the Bug or Issue
Platform
The text was updated successfully, but these errors were encountered: