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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buf cannot resolve dependencies when we use workspaces #2513

Open
shuheiktgw opened this issue Oct 25, 2023 · 2 comments
Open

Buf cannot resolve dependencies when we use workspaces #2513

shuheiktgw opened this issue Oct 25, 2023 · 2 comments

Comments

@shuheiktgw
Copy link

shuheiktgw commented Oct 25, 2023

Hi, team 馃憢 Thank you so much for your kind support. We just recently started using buf, but one problem we face is if we use a workspace that depends on another workspace, buf seems to fail to resolve the dependencies. I've created a repository to reproduce the problem.

If you run buf generate at the root, it seems buf fails to resolve the dependency to google/rpc/code.proto. Would you guide us on what is wrong with our configuration? I found a similar issue, #687, but it just stopped using a workspace to avoid the issue.

buf generate 
proto_deps/shuheiktgw/test1/v1/message.proto:6:8:google/rpc/code.proto: does not exist

I'm currently using buf 1.27.1.

buf --version
1.27.1

Thanks, in advance!

@shuheiktgw
Copy link
Author

shuheiktgw commented Oct 25, 2023

OK, I think I've finally figured out what was wrong with the configuration (but let me leave it open to confirm if my understanding is correct). What I needed to do was

  1. Create a buf.build/shuheiktgw/test1 repository, and push the latest changes to create a commit
  2. Declear the following dependencies in proto/buf.yaml and run buf mod update to create buf.lock
+deps:
+  - buf.build/shuheiktgw/test1

Then buf generate at the root works just fine. I thought workspaces work fine without creating actual repositories, but IIUC, buf needs them to create a correct buf.lock and resolve dependencies.

@timostamm
Copy link
Member

Hey @shuheiktgw, I can confirm that your solution is correct. We're looking to improve the behavior in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants