N
Neon5mo ago
continuing-cyan

TS error in example code

The code suggested on the Prisma tab in these docs gives a TS error on the const adapter = new PrismaNeon(pool); line:
2345: Argument of type 'Pool' is not assignable to parameter of type 'PoolConfig'. Types of property 'options' are incompatible. Type 'PoolOptions' is not assignable to type 'string'.
2345: Argument of type 'Pool' is not assignable to parameter of type 'PoolConfig'. Types of property 'options' are incompatible. Type 'PoolOptions' is not assignable to type 'string'.
I'm on the latest version of Prisma (6.6.0). (I'm struggling to get Prisma, Neon, Authjs, its middleware, and Nextjs to all work together, and this TS error is currently my only lead.)
Neon
Neon serverless driver - Neon Docs
The Neon serverless driver is a low latency Postgres driver for JavaScript and TypeScript that allows you to query data from serverless and edge environments over HTTP or WebSockets in place of TCP. T...
4 Replies
like-gold
like-gold5mo ago
hi! did you find the solution?
robust-apricot
robust-apricot5mo ago
I also have this issue if there are any updates on this Hey guys I found where this issue occurs. https://github.com/prisma/prisma/commit/3f27f119919cd77eda82ebb2e0d06f8d26f7ff1f The code was recently changed where the .connect function automatically creates the pool for you using the config.
export class PrismaNeonAdapterFactory implements SqlDriverAdapterFactory {
readonly provider = 'postgres'
readonly adapterName = packageName

constructor(private readonly config: neon.PoolConfig, private options?: PrismaNeonOptions) {}

async connect(): Promise<SqlDriverAdapter> {
return new PrismaNeonAdapter(new neon.Pool(this.config), this.options)
}
}
export class PrismaNeonAdapterFactory implements SqlDriverAdapterFactory {
readonly provider = 'postgres'
readonly adapterName = packageName

constructor(private readonly config: neon.PoolConfig, private options?: PrismaNeonOptions) {}

async connect(): Promise<SqlDriverAdapter> {
return new PrismaNeonAdapter(new neon.Pool(this.config), this.options)
}
}
When the docs was created you were originally interacting with PrismaNeonAdapter seems like it was changed so you interact with this new factory class which makes the pool for you. These are the correct docs https://github.com/prisma/prisma/blob/main/packages/adapter-neon/README.md The neon docs needs to be updated the resemble the new code changes.
robust-apricot
robust-apricot5mo ago
This is the PR I opened to update the docs https://github.com/neondatabase/website/pull/3389
GitHub
docs: Updates Prisma docs to align with recent changes by harrisonh...
In reference to prisma/prisma#26633 Pool is now handled by the PrismaNeon class (PrismaNeonAdapterFactory) export class PrismaNeonAdapterFactory implements SqlDriverAdapterFactory { readonly prov...
absent-sapphire
absent-sapphire5mo ago
Thank you so much for the PR @Duck! I approved it and will get it merged

Did you find this page helpful?