question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Prisma ORM

See original GitHub issue

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

Terminus is quite useful for checking the health of your database and it would be great if it would support Prisma ORM.

Describe the solution you’d like

Support for Prisma ORM, similar to TypeOrmHealthIndicator , SequelizeHealthIndicator and MongooseHealthIndicator.

Teachability, documentation, adoption, migration strategy

The terminus recipe in the NestJS docs would need to be updated with a PrismaHealthIndicator.

To the best of my understanding, the change to the documentation would be fairly minimal.

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

I work at Prisma and we have seen a lot of NestJS users adopting Prisma for the ORM layer in their application. So having better support for the ORM would be great for developers using NestJS with Prisma!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:11
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
jfairleycommented, Jun 15, 2022

Btw, in case anyone comes here and just wants a simple health indicator, I have a Stackoverflow answer for it.

https://stackoverflow.com/a/71445270/317951

import { Injectable } from "@nestjs/common";
import { HealthCheckError, HealthIndicator, HealthIndicatorResult } from "@nestjs/terminus";
import { PrismaService } from "./prisma.service";

@Injectable()
export class PrismaHealthIndicator extends HealthIndicator {
  constructor(private readonly prismaService: PrismaService) {
    super();
  }

  async isHealthy(key: string): Promise<HealthIndicatorResult> {
    try {
      await this.prismaService.$queryRaw`SELECT 1`;
      return this.getStatus(key, true);
    } catch (e) {
      throw new HealthCheckError("Prisma check failed", e);
    }
  }
}
4reactions
BrunnerLiviocommented, Nov 16, 2021

Thanks for the suggestion! I am open to review any PRs around this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma | Next-generation ORM for Node.js & TypeScript
Prisma is a next-generation Node.js and TypeScript ORM for PostgreSQL, MySQL, SQL Server, SQLite, MongoDB, and CockroachDB. It provides type-safety, ...
Read more >
Prisma Help Center
Find resources and get help from our support team for both the Prisma ORM and Prisma Data Platform.
Read more >
Databases supported by Prisma
This page lists all the databases and their versions that are supported by Prisma.
Read more >
Express & Prisma | Next-Generation ORM for SQL DBs
Prisma is a next-generation ORM for Node.js & TypeScript. It's the easiest way to build Express apps with MySQL, PostgreSQL & SQL Server...
Read more >
Contact Support - Prisma
Go to the Prisma Data Platform and click Support in the upper-right. · Fill out all fields in the pop-up below. Note The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found