question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GRPC within service worker / web worker

See original GitHub issue

Im trying to run GRPC from inside a service worker. It works fine from inside the main application thread and only throws an error from inside a service worker.

const media = new MediaServiceClient(process.env.VUE_APP_GRPC)
media.index(pagination, headers)

Error:

Uncaught (in promise) TypeError: e.serializeBinary is not a function

Im assuming this is due to how GRPC communicates to the backend services and assuming this is not possible to do at the moment?

Thanks

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
wenbozhucommented, Jul 12, 2019

We have a patch in google-closure to support service workers (via fetch) and will try to get the change to github soon.

4reactions
edyucommented, Jun 2, 2020

@travikk if it’s any use to hear, we’ve been using grpc-web in web workers without a problem.

How so? The generated code references window object which is not available in web worker. @markns

Read more comments on GitHub >

github_iconTop Results From Across the Web

Single scheduler — Multiple Worker Architecture with GRPC ...
The scheduler is a gateway to the worker cluster. Requests to the scheduler are made via HTTP, these requests are then translated into...
Read more >
The state of gRPC in the browser
The gRPC HTTP/2 implementations all support the four method types: unary, server-side, client-side, and bi-directional streaming. However, the ...
Read more >
@ngx-grpc/worker-client - npm
Angular gRPC framework: worker client package. Latest version: 3.0.3, last published: 2 months ago. Start using @ngx-grpc/worker-client in ...
Read more >
What Are gRPC Web Services and When Should I Use Them?
Instead, like WSDL/SOAP services, gRPC is a technical specification that lets you call methods over the Internet without worrying about what ...
Read more >
Performance best practices with gRPC | Microsoft Learn
gRPC is designed for high-performance services. ... A worker in the client is sending or receiving regular messages with a gRPC service.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found