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

Report feedback error #1029

Closed
NathaelB opened this issue May 13, 2024 · 2 comments
Closed

Report feedback error #1029

NathaelB opened this issue May 13, 2024 · 2 comments

Comments

@NathaelB
Copy link

Package version

^20.5.1

Describe the bug

I created a health module on my api and initialised a service.

At first I used a select * from users limit 1; to see if the connection on my postgres was good. In the meantime I learned about the await db.manager.report().

The report seems to work at first glance, but when I tried to check my health ready when my postgres container was switched off, I still had the connection: All connections are healthy

import db from '@adonisjs/lucid/services/db'
import HealthException, { HealthErrors } from '#apps/shared/exceptions/health_exception'

export default class HealthService {
  async checkDb(): Promise<{ displayName: string, health: { healthy: boolean, message: string }, meta: any[] }> {
    return db.manager.report()
  }

  async sendReport() {
    try {
      const reportDb = await this.checkDb()
      return {
        healthy: reportDb.health.healthy,
        report: {

          appKey: {
            displayName: 'App Key Check',
            health: {
              healthy: true,
            },
          },
          db: reportDb
        },
      }
    } catch (e) {
      throw e
    }
  }
}

Reproduction repo

No response

@RomainLanz
Copy link
Member

Hey @NathaelB! 👋🏻

Since you posted your message, a health check system was officially released.

Does that fixes your issue?
📚 https://docs.adonisjs.com/guides/digging-deeper/health-checks#dbcheck

@thetutlage
Copy link
Member

Closing since no response from the issue reporter and not actionable as well

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

3 participants