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

[BUG]: Drizzle ORM does not throw error when PostgreSQL server is unreachable #3572

Open
1 task done
ASgmbv opened this issue Nov 17, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@ASgmbv
Copy link

ASgmbv commented Nov 17, 2024

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.36.3

What version of drizzle-kit are you using?

0.28.1

Other packages

No response

Describe the Bug

When attempting to connect to a PostgreSQL database that is not running, Drizzle ORM does not throw an error as expected. This silent failure makes it difficult to implement proper error handling and could lead to unexpected behavior in production environments.

Current Behavior

  • No error is thrown when the PostgreSQL server is not running
  • The application continues to run without indicating connection failure

Expected Behavior

  • Drizzle should throw an error when unable to establish a connection with PostgreSQL
  • Connection failure should be immediately apparent

Steps to Reproduce

import { FastifyInstance } from "fastify";
import { drizzle, NodePgDatabase } from "drizzle-orm/node-postgres";
import * as schema from "../db/schema";
import fp from "fastify-plugin";

export type db = NodePgDatabase<typeof schema>;

// TODO: not throwing error when postgres is not running
async function db(app: FastifyInstance) {
  const db = drizzle(app.config.DATABASE_URL, {
    schema: schema,
  });

  app.decorate("db", db);
}

export default fp(db);
@ASgmbv ASgmbv added the bug Something isn't working label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant