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

grpc-js: Timer ref and unref might not exist #1709

Conversation

murgatroid99
Copy link
Member

This fixes #1708. We actually ran into the same issue before in #1077 but I forgot when I implemented #1688.

@nicograef
Copy link

Hey @murgatroid99 , I ran into this issue today and could not find any solution to the issue (besides now finding this PR).
I checked the respective file grpc-js/src/backoff-timeout.ts and just removed all the ref/unref the logic. Without it it worked perfectly fine.

As I understand it, this code is made for running in a Node Environment and not inside a Browser. Am I correct?

So the first problem is the wrong type NodeJS.Timer

// node_modules/@grpc/grpc-js/src/backoff-timeout.ts : 45

private timerId: NodeJS.Timer;

Which is wrong for the Browser Environment - it's number there.
Hence, the code fails in the Browser (if you don't remove the .ref() .unref() calls).

Anyways, cool that you fixed this already. For when is the release planned?

Besides, how does grpc-js generally handle the two environments?

Thanks!

@murgatroid99
Copy link
Member Author

This library is made to work on Node, not browsers. The reason this timers thing is an issue is Electron: Electron fully supports the Node APIs, except that it uses browser timers instead of web timers. So we support Electron, but we have to make changes like this specifically for Electron.

This should release soon, once it gets a code review.

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.

None yet

3 participants