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: failed to import google/api/annotations.proto #165

Closed
prashcr opened this issue May 23, 2016 · 0 comments
Closed

Error: failed to import google/api/annotations.proto #165

prashcr opened this issue May 23, 2016 · 0 comments

Comments

@prashcr
Copy link

prashcr commented May 23, 2016

I tried including the option syntax to my .proto file then I got this error when I tried running my gRPC Node.js server. It seems it has tried to execute the import as if it were referring to a local file in the current dir.

I'm also confused about the usage of this library. In Go, the generated .pb.go and .pb.gw.go seem to be imported and used by the proxy server which written in Go. How does this work when stubs of other languages are generated?

I love the idea of this library, and I thank you for your help!

/Users/prashanthcr/code/grpc_calculator/node_modules/protobufjs/dist/ProtoBuf.js:4640
                            throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
                            ^

Error: failed to import '/Users/prashanthcr/code/grpc_calculator/protos/google/api/annotations.proto' in '/Users/prashanthcr/code/grpc_calculator/protos/calculator.proto': file not found
    at Error (native)
    at ProtoBuf.Builder.BuilderPrototype.import (/Users/prashanthcr/code/grpc_calculator/node_modules/protobufjs/dist/ProtoBuf.js:4640:35)
    at Object.ProtoBuf.loadJson (/Users/prashanthcr/code/grpc_calculator/node_modules/protobufjs/dist/ProtoBuf.js:5135:26)
    at Object.ProtoBuf.loadProto (/Users/prashanthcr/code/grpc_calculator/node_modules/protobufjs/dist/ProtoBuf.js:5038:25)
    at Object.ProtoBuf.loadProtoFile (/Users/prashanthcr/code/grpc_calculator/node_modules/protobufjs/dist/ProtoBuf.js:5084:

proto

syntax = "proto3";

package calculator;

import "google/api/annotations.proto";

message Number {
  double value = 1;
}

message NumberPair {
  Number num1 = 1;
  Number num2 = 2;
}

service Calculator {
  rpc Add(NumberPair) returns (Number) {
    option(google.api.http) = {
      post: "/v1/add"
      body: "*"
    };
  }
  rpc Sub(NumberPair) returns (Number) {
    option(google.api.http) = {
      post: "/v1/sub"
      body: "*"
    };
  }
}
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

1 participant