Skip to content

Prisma MariaDB Adapter Times Out With “pool timeout” When Underlying MariaDB Authentication Fails #28879

Closed as duplicate

Description

@manojsinghindiit

Bug description

pool timeout: failed to retrieve a connection from pool after 10001ms
(pool connections: active=0 idle=0 limit=10)

when we start app it connect db successfully, but when we hit api to execute query it says pool timeout in localhost mysql db

Image Image

Severity

🚨 Critical: Data loss, app crash, security issue

Reproduction

Expected vs. Actual Behavior

it show execute successfully, please guide if i'am doing something wrong!

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

Workaround

Prisma Schema & Queries

// Add relevant schema.prisma snippet
// Add relevant Prisma Client query

Prisma Config

// Add your `prisma.config.ts`

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

// Prisma version output

Activity

  1. Ashkumar7 commented on Dec 8, 2025

    @Ashkumar7

    yes i m sure there is definitely issue with maria-db adapter. because i also face connection timeout issue . it happens after i start the app and executing queries.

  2. yc-w-cn commented on Dec 10, 2025

    @yc-w-cn

    I encountered the same issue. First, I configured the logger/log options to print intermediate logs, which then revealed the actual cause of the connection failure. After that, I was able to resolve the issue. The problem I faced was "ip host is blocked".

    import { Injectable, OnModuleDestroy, Logger } from '@nestjs/common';
    import { ConfigService } from '@nestjs/config';
    import { PrismaMariaDb } from '@prisma/adapter-mariadb';
    
    import { PrismaClient } from '@/generated/prisma/client';
    
    @Injectable()
    export class PrismaService extends PrismaClient implements OnModuleDestroy {
      // Built-in NestJS logger instance for PrismaService
      private readonly logger = new Logger(PrismaService.name);
    
      constructor(configService: ConfigService) {
        const adapter = new PrismaMariaDb({
          connectionLimit: Number(configService.getOrThrow('DB_CONNECTION_LIMIT')),
          database: configService.getOrThrow('DB_DATABASE'),
          host: configService.getOrThrow('DB_HOST'),
          password: configService.getOrThrow('DB_PASSWORD'),
          user: configService.getOrThrow('DB_USER'),
          // Prisma adapter logger configuration
          logger: {
            network: (info) => {
              this.logger.log('PrismaAdapterNetwork', info);
            },
            query: (info) => {
              this.logger.log('PrismaAdapterQuery', info);
            },
            error: (error) => {
              this.logger.error('PrismaAdapterError', error);
            },
            warning: (info) => {
              this.logger.warn('PrismaAdapterWarning', info);
            },
          },
        });
    
        // Prisma client initialization with adapter and full log levels
        super({
          adapter,
          log: ['query', 'info', 'warn', 'error'],
        });
      }
    
      // Connect to database when module is initialized
      async onModuleInit() {
        await this.$connect();
        this.logger.log('Database connection succeeded');
      }
    
      // Disconnect from database when module is destroyed
      async onModuleDestroy() {
        await this.$disconnect();
        this.logger.log('Database connection disconnected');
      }
    }
    
  3. added
    bug/1-unconfirmed
    on Dec 10, 2025
  4. jacek-prisma commented on Dec 11, 2025

    @jacek-prisma
    Contributor

    Closing as a duplicate

  5. HafizSyedAhmedAli commented on May 9, 2026

    @HafizSyedAhmedAli

    Thank you this worked i had to add allowPublicKeyRetrieval: true, in the adapter options

  6. surajprasad13 commented on Sep 23, 2026

    @surajprasad13

    This worked for me as well thanks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedkind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions