bufbuild / buf

The best way of working with Protocol Buffers.

Home Page:https://buf.build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WARN bufimagebuild File imports not found in your local dependencies

alikleit opened this issue · comments

I'm working with Buf workspaces locally, with the following files:

common/company/common/v1/enums.proto

package company.common.v1;

enum MyEnum { 
   ....
}

user-apis/company/user/v1/user.proto

package company.user.v1;


message MyContract {
  string id = 1;
  company.common.v1.MyEnum my_enum= 2;
}

and above is defined in the buf.work.yaml as follows:

version: v1
directories:
  - common
  - user-apis

Whenever I build, I get the following warning:

WARN bufimagebuild File "company/user/v1/user.proto" imports "company/common/v1/enums.proto", which is not found in your local files or direct dependencies, but is found in local workspace module "buf.build/company/common". Declare dependency "buf.build/company/common" in the deps key in buf.yaml.

Declaring the dependency means that it should exist in BSR, additionally the docs mention the following:

You don't need to add modules to the deps field to use them locally within a workspace, but you will need to do so when you're ready to [push your modules](https://buf.build/docs/reference/workspaces#pushing-modules) to the BSR`

How to ignore this when working locally?

We'd need to see your buf.yaml files to comment fully, but this likely means that you have name: buf.build/company/common in common/buf.yaml. The warning is valid - if you have a named module, you should make sure it is declared as a dependency, even if buf.build/company/common is not in the BSR. Just add a dep for this in user-apis/buf.yaml.

When we add this to deps, it complains that the name is not in the BSR @bufdev

If you can provide a specific, reproducible example, we can look into it - perhaps in a temporary GitHub repo.

Closing as we don't have a reproducible example - if you add one, we'll reopen, thanks.