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

Cannot use grpc-web inside web worker #838

Closed
edyu opened this issue Jun 2, 2020 · 1 comment
Closed

Cannot use grpc-web inside web worker #838

edyu opened this issue Jun 2, 2020 · 1 comment

Comments

@edyu
Copy link

edyu commented Jun 2, 2020

I'm using the dart version of grpc-web and when using it under web worker, the generated code is using window global object which is not available.

The line causing the problem is:
_stub = grpc.Client(GrpcWebClientChannel.xhr(Uri.parse('http://${server}:${port}')));

grpc.Client is generated code.

Here is the error output

Uncaught ReferenceError: 
window is not defined
    at Object.main (worker.dart:28)
    at js_helper.dart:3221
    at js_helper.dart:3221
    at dartProgram (js_helper.dart:3221)
    at js_helper.dart:3221
@stanley-cheung
Copy link
Collaborator

There's no support for making this work in service worker yet. Folding this under #587

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

No branches or pull requests

2 participants