Grpc-web: GRPC within service worker / web worker

Created on 8 Jul 2019  路  5Comments  路  Source: grpc/grpc-web

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.

typescript 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

Most helpful comment

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

All 5 comments

same problem here

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

@wenbozhu has this been resolved yet?

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

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oferb picture oferb  路  5Comments

smnbbrv picture smnbbrv  路  4Comments

developerlaoz picture developerlaoz  路  3Comments

aberasarte picture aberasarte  路  6Comments

barrymichaeldoyle picture barrymichaeldoyle  路  4Comments