envoyproxy/envoy-filter-example

Unable to reference to envoy grpc proto when using envoy 1.8.0

aejeet opened this issue · 1 comments

I am using the http-filter-example template to implement a custom envoy http filter of my own. In the filter config i need a reference to api/envoy/api/v2/core/grpc_service.proto. The following BUILD script was working fine with envoy 1.7.1. But it fails to compile with envoy 1.8.0.

I am new to bazel, and any help will be highly appreciated. I need 1.8.0 for some of the additional capabilities and staying on 1.7.1 is not an option

My filter config file filter_config.proto

syntax = "proto3";
package myproto;

import "validate/validate.proto";
import "envoy/api/v2/core/grpc_service.proto";

message EpmpCmds {
  // The external  gRPC service configuration 
  envoy.api.v2.core.GrpcService cnc_service = 1;

 // additional config -  mostly boolean fields
}

My BUILD file

package(default_visibility = ["//visibility:public"])

load(
    "@envoy//bazel:envoy_build_system.bzl",
    "envoy_cc_binary",
    "envoy_cc_library",
    "envoy_cc_test_library",
    "envoy_cc_test",
)

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_library")

api_proto_library(
    name = "filter_config_proto",
    srcs = ["filter_config.proto"],
    deps = [
        "@envoy_api//envoy/api/v2/core:grpc_service",
    ],
)

// additional lines

Encountered ERROR

DEBUG: /private/var/tmp/_bazel_ajit_verma/1f2dd7d102aa45a25d81491054a38483/external/envoy/bazel/repositories.bzl:120:5: External dep build exited with return code: 0
ERROR: /Users/ajit_verma/Workspace/custom-envoy/epmp/filters/epmp_cmds/BUILD:13:1: target '@envoy_api//envoy/api/v2/core:grpc_service' is not visible from target '//epmp/filters/epmp_cmds:config_proto'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: Analysis of target '//:envoy' failed; build aborted: Analysis of target '//epmp/filters/epmp_cmds:config_proto' failed; build aborted

Found the fix in another thread
envoyproxy/envoy#5334