neondatabase / neondatabase/serverless

Pool type incompatible with kysely 0.29 PostgresDialect (Client.connect signature mismatch)

Open
#210 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
548
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Summary

Passing Pool from @neondatabase/serverless to kysely's PostgresDialect no longer type-checks after kysely 0.29.

Reproduction

import { Pool } from '@neondatabase/serverless';
import { Kysely, PostgresDialect } from 'kysely';

new Kysely({
  dialect: new PostgresDialect({
    pool: new Pool({ connectionString }),
  }),
});

Error

Type 'Pool' is not assignable to type 'PostgresPool | ((options?: AbortableOperationOptions) => Promise<PostgresPool>)'.
  Type 'Pool' is not assignable to type 'PostgresPool'.
    The types returned by '(new Client(...)).connect()' are incompatible between these types.
      Type 'Promise<void>' is not assignable to type 'Promise<PostgresClient>'.
        Type 'void' is not assignable to type 'PostgresClient'.

Cause

kysely 0.29 (PR #1796) tightened the structural PostgresClient.connect() return type from Promise<void> to Promise<PostgresClient> as groundwork for query cancellation. The Pool.Client exposed by @neondatabase/serverless still has connect(): Promise<void> — which matches the underlying pg API.

Context

  • @neondatabase/serverless: 1.1.0
  • kysely: 0.29.2
  • Neon's own docs still recommend exactly this pattern, so this breaks the recommended setup.
  • Kysely maintainers have stated in the past they consider Neon-Pool ↔ PostgresDialect integration out of scope (kysely#1441).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the TypeScript reproduction using @neondatabase/serverless Pool and Kysely's PostgresDialect. Compare Pool.Client.connect(), Kysely 0.29's PostgresClient expectation, and the referenced Kysely PR, then check Neon's Kysely guide. Done means the recommended setup type-checks with the reported versions without weakening the stated integration contract.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
backend-api-design, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.