Skip to content
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

Resolve issues that popped up with grpc-js 1.10.x series #609

Merged
merged 12 commits into from
Jun 6, 2024

Conversation

davidfiala
Copy link
Contributor

  • properly end streams with call.emit('error', ...) instead of call.destroy(...)
  • due to breaking change in grpc-js which always emits a 'cancelled' event for RPCs even when they complete successfully, this PR includes logic to prevent the abortsignal from triggering after a call completes

tested on linux with node v20.14.0 and grpc-js left as-is as well as when grpc-js was pinned to 1.10.8 via resolutions in package.json.

unfortunately my workstation hangs on nice-grpc-server-health:test and nice-grpc-web:test so I'm curious to see what the CI pipeline does with them

should fix #607 and #555

Per discussion in deeplay-io#590 this version of yarn is known working
…ures seem to match the output in deeplay-io#555 - work debug from here
…nce the 'cancelled' event is called after ever RPC regardless of success outcome, I modified nice-grpc to track when an RPC completes. Once an RPC completes, I prevent the abort signal from being able to be triggered. (2) corrected how errors are propagated back from server to client by using call.emit('error', ...) instead of call.destroy(...)
…tly telling developers what is allowed. In the past I'd seen this before and it wasn't immediately obvious to me what had happened.
…de v18+ and I believe we only had the forced compat for v14 or v16 which required --experimental-abortcontroller
…for node we only support node versions with abort-controller anyhow
…n when we discovered 1.10.x was broken) - tested locally with node v18.20.3 working at this point with "resolutions": {"@grpc/grpc-js": "1.9.5"}, and also with resolutions pinned to 1.10.8 -- all tests pass, but it's worth noting that nice-grpc-web is still slow (just over 5min), as it always appears to have been on my PC

updated .nvmrc back to 18.x series and explicitly updated @types/node to v18.x series as well.
…execution) that nodejs internals which we were previously accessing via an `as any` cast are indeed in the approximate shape that we expect.
@davidfiala
Copy link
Contributor Author

davidfiala commented Jun 6, 2024

Latest snapshot ought to have everything required to close out #555

I didn't test this hypothesis due to time, but based on discussion in grpc/grpc-node#2681 (comment) it is possible that nice-grpc will perform inconsistently in grpc-js v1.10.0 and v1.10.1

My related questions to the grpc-js team are in: grpc/grpc-node#2771

I'd simply advise people to skip those versions out of safety.

Copy link
Contributor

@aikoven aikoven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see the passing tests!

packages/nice-grpc/package.json Outdated Show resolved Hide resolved
packages/nice-grpc/src/__tests__/serverStreaming.ts Outdated Show resolved Hide resolved
packages/nice-grpc/src/server/createCallContext.ts Outdated Show resolved Hide resolved
…entially incompatible 1.10.0 and 1.10.1 (2) document new tests (3) use existing library defer-promise in tests
Copy link
Contributor

@aikoven aikoven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good. I'm going to merge it now

@aikoven aikoven merged commit bdfc754 into deeplay-io:master Jun 6, 2024
6 checks passed
@aikoven
Copy link
Contributor

aikoven commented Jun 6, 2024

Thanks @davidfiala! I will publish a release right away.

@aikoven
Copy link
Contributor

aikoven commented Jun 6, 2024

Published 📦 [email protected]

@danielloader
Copy link

Just to clarify something since I've spent a day or two digging, would this fix rule out the problem I've highlighted in another library that utilise nice-grpc?

The link is above in the mentioned reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server-side streaming thrown errors are not propagating to client
3 participants