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

Buf grpc/node generated code import deprecated grpc module #3298

Closed
afifurrohman-id opened this issue Sep 7, 2024 · 1 comment
Closed

Buf grpc/node generated code import deprecated grpc module #3298

afifurrohman-id opened this issue Sep 7, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@afifurrohman-id
Copy link

GitHub repository with your minimal reproducible example (do not fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)

https://github.com/afifurrohman-id/buf-node-bug.git

Commands

buf generate

Output

None

Expected Output

a generated code gen/hello_grpc_pb.js must import new module @grpc/grpc-js not grpc

Anything else?

No response

@afifurrohman-id afifurrohman-id added the Bug Something isn't working label Sep 7, 2024
@timostamm
Copy link
Member

Thanks for the example, @afifurrohman-id. The grpc-node code generator plugin generates imports for the deprecated package grpc by default. You have to pass an option to tell it to generate imports for @grpc/grpc-js.

The option is grpc_js, and it is documented here in the grpc-node repository. To use it with the buf CLI, you add it as a plugin option:

plugins:
  - remote: buf.build/grpc/node:v1.12.4
    out: gen
+   opt: grpc_js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants