0

I am trying to run the (https://github.com/googleapis/nodejs-speech/blob/main/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto) .proto File from Google in NestJS and I get the error:

Error

Is someone here facing the same problem?

Ps. I have written just a simple gRPC code, like:

async function bootstrap() {
  const app = await NestFactory.createMicroservice(AppModule, {
    transport: Transport.GRPC,
    options: {
      options: 'localhost:3001',
      package: 'google.cloud.speech.v1p1beta1', 
      protoPath: join(__dirname, './speech/speech.proto'),
    }
  });
  await app.listen();
  console.log(`Microservice is listening`);
}
metodribic
  • 1,561
  • 17
  • 27

1 Answers1

0

I'm unclear on what you're trying to do but, to answer your question, the error's arising because speech.proto depends on the file: operations.proto (link).

See this comment for what appears to be an explanation for how to do this.

Things that compile protocol buffers files, include a mechanism by which you can reference (import path) depdendent files. You should clone (at least) operations.proto (it may include further dependencies) locally and configure your code to reference the cloned directory as part of the build process.

NOTE Please include errors directly in questions rather than reference images as it's not possible to copy content from images which may help in answering questions and referenced images may be deleted leaving the question orphaned.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88