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

Error while running buf generate command #2955

Closed
bharath-reddy-tm opened this issue May 8, 2024 · 6 comments
Closed

Error while running buf generate command #2955

bharath-reddy-tm opened this issue May 8, 2024 · 6 comments

Comments

@bharath-reddy-tm
Copy link

bharath-reddy-tm commented May 8, 2024

I have buf installed(version: 1.30.0) locally and trying to run buf generate command. But it is failing with following error:
Failure: files with different commits for the same module buf.build/grpc-ecosystem/grpc-gateway: protoc-gen-openapiv2/options/openapiv2.proto:18e8bf1967c947f5bd991710f490df5f and proto/mygateway-gateway/*******.proto

Even with --verbose flag I can see only one line in terminal. Please help me.

@timostamm
Copy link
Member

Can you share some details? Specifically:

  • Your buf.yaml
  • Your buf.work.yaml, if you are using one

@bharath-reddy-tm
Copy link
Author

bharath-reddy-tm commented May 8, 2024

@timostamm Following is the .yaml file

version: v1beta1
plugins:

  • name: go
    out: .
    opt:
    • paths=source_relative
  • name: go-grpc
    out: .
    opt:
    • paths=source_relative
  • name: grpc-gateway
    out: .
    opt:
    • paths=source_relative
    • generate_unbound_methods=true
  • name: openapiv2
    out: .
    opt:
    • allow_repeated_fields_in_body=true

I don't think we are using any .work.yaml file

@timostamm
Copy link
Member

This looks like a buf.gen.yaml file. Unfortunately, this doesn't give me any information about what modules and dependencies you use.

Do you really not have a buf.yaml file anywhere? What command exactly are you running?

@bharath-reddy-tm
Copy link
Author

bharath-reddy-tm commented May 8, 2024

@timostamm I cannot find any buf.yaml file in repo. I am running buf generate --template *.buf.gen.yaml --path *.proto

@timostamm
Copy link
Member

The error messages includes "module buf.build/grpc-ecosystem/grpc-gateway", so you must be using module dependencies somehow, which requires a buf.yaml file.

Your are using a v1beta1 buf.gen.yaml, which has been outdated for quite some time (see the migration guide), and your project seems to be in a broken state. I recommend to set up a small project from scratch to get familiar with the concepts. The grpc-gateway has excellent step-by-step guides to get you started with buf right in their README. If you follow the guide, it should be quite simple to get the basic annotations running, and you can add openapi annotations in a separate step. This will give you a working example to compare against.

@bharath-reddy-tm
Copy link
Author

Thank you @timostamm

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

3 participants