gkampitakis / fastify-custom-healthcheck

Fastify plugin to add health route in your server that asserts custom functions
https://www.npmjs.com/package/fastify-custom-healthcheck
MIT License
16 stars 4 forks source link

Unit & Integration Test timed out #21

Open dina75 opened 1 year ago

dina75 commented 1 year ago

I have added fastify-custom-healthcheck for extending health functionalities of my app. but when i run my unit or integration tests it was failing at the time of hitting app.ready() and didn't even throw any valid errors other than 'Exceeded timeout of 5000 ms for a hook'. When i run without 'fastify-custom-healthcheck', it works fine. I will appreciate your help, if anyone can

**Code snippet***** fastify .register(customHealthCheck, { path: ${routePrefix}/health/check, info: { message: 'HealthCheck' }, exposeFailure: true }) .then(() => { astify.addHealthCheck('sync', () => true) })

gkampitakis commented 1 year ago

I am not able to reproduce 🤔

Node Version: v18.16.0 fastify: "^4.22.2" "fastify-custom-healthcheck": "^3.1.0"

// Require the framework and instantiate it
const fastify = require('fastify')({ logger: true })
const customHealthCheck = require('fastify-custom-healthCheck');

fastify
  .register(customHealthCheck, {
    path: "/health/check",
    info: { message: 'HealthCheck' },
    exposeFailure: true
  })
  .then(() => {
    fastify.addHealthCheck('sync', () => true)
  })

fastify.ready().then(() => {
  console.log("everything ready")
}).then(() => {
  // Run the server!
  fastify.listen({ port: 3000 }, (err) => {
    if (err) {
      fastify.log.error(err)
      process.exit(1)
    }
  })
})