grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.64k stars 765 forks source link

TypeError: Cannot read property 'MethodInfo' of undefined with webpack 5 #1151

Closed bram-abe closed 3 years ago

bram-abe commented 3 years ago

Hai,

I'am using protoc to compile .proto to commonjs and works fine.

the problem happen when I'm using webpack 5 with error like this:

TypeError: Cannot read property 'MethodInfo' of undefined

the error refer to auth_grpc_web_pb.js .

How to solve this problem ? Please advice, thank you

UPDATE:

I fallback to grpc-web v1.2.1 and the error was gone.

but I still dont know why this is happen to grpc-web v1.3.0

TaroSunn commented 3 years ago

because v1.3.0 Removed AbstractClientBase.MethodInfo

1139

bram-abe commented 3 years ago

I see... How to set protoc not to produce those function when import to commonjs ?

Or it's safe to manually remove them from auto generated file ?

sampajano commented 3 years ago

@bram-abe Thanks for the report! 😃

I suspect the issue is likely because you're using an old version of protoc-gen-grpc-web. Could you try installing the latest version (1.3.0) following this instruction, and see if the issue goes away?

(btw i'm curious how are you typically getting your protoc-gen-grpc-web and whether we can make it easier for you to get the latest version :))

bram-abe commented 3 years ago

@bram-abe Thanks for the report! 😃

I suspect the issue is likely because you're using an old version of protoc-gen-grpc-web. Could you try installing the latest version (1.3.0) following this instruction, and see if the issue goes away?

(btw i'm curious how are you typically getting your protoc-gen-grpc-web and whether we can make it easier for you to get the latest version :))

aah you're right the protoc-gen-grpc-web still an old version, now the issues are gone after reinstalling. Somehow I'am missing on the middle of update all deps. process and miss to overwrite the old version protoc-gen-grpc-web with the new one and set it on windows path.

Thank You for help

sampajano commented 3 years ago

yw! Great to hear the issue is resolved! 😃