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

The health.proto missing from dist #224

Closed
ethanrubio opened this issue Jun 5, 2019 · 1 comment
Closed

The health.proto missing from dist #224

ethanrubio opened this issue Jun 5, 2019 · 1 comment

Comments

@ethanrubio
Copy link

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

If you try to use the gRPC health indicator without passing in options to override the proto path, you'll end up with an error like this:

[Nest] 1327   - 06/05/2019, 6:19 PM   [ExceptionHandler] ENOENT: no such file or directory, open '/workspace/node_modules/@nestjs/terminus/dist/health-indicators/microservice/protos/health.proto'

Expected behavior

You should be able to use the default health proto that comes with this package.

Minimal reproduction of the problem with instructions

// main.ts
import { NestFactory } from '@nestjs/core';
import { ApplicationModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(ApplicationModule);
  await app.listen(3000);
}
bootstrap();
// health.module.ts
import { Module } from '@nestjs/common';
import {
  TerminusModule,
  TerminusModuleOptions,
  GRPCHealthIndicator,
} from '@nestjs/terminus';

const getTerminusOptions = (
  grpc: GRPCHealthIndicator,
): TerminusModuleOptions => ({
  endpoints: [
    {
      url: '/health',
      healthIndicators: [
        async () =>
          grpc.checkService('hero_service', 'hero.health.v1', {
            timeout: 2000,
          }),
      ],
    },
  ],
});

@Module({
  imports: [
    TerminusModule.forRootAsync({
      inject: [GRPCHealthIndicator],
      useFactory: getTerminusOptions,
    }),
  ],
})
export class HealthModule {}
// app.module.ts
import { Module } from '@nestjs/common';
import { HealthModule } from './health.module';

@Module({
  imports: [HealthModule],
})
export class ApplicationModule {}
curl localhost:3000/health

Yes, I know this example does not return a health indicator without having the corresponding gRPC health controller in this setup, but you'll still get the error regardless.

What is the motivation / use case for changing the behavior?

This is most likely caused by not copying the health.proto file into the dist folder when the package is published.

Environment


Nest version: X.Y.Z

 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

@BrunnerLivio
Copy link
Member

Thanks for reporting! Indeed, I forgot to copy the proto file into the dist folder.
Fixed by using gulp now as build task and copying proto files in @nestjs/terminus@6.3.1.

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

No branches or pull requests

2 participants