Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@prisma/adapter-neon
Advanced tools
Prisma driver adapter for Neon Serverless Driver. Refer to the announcement blog post and our docs for more details.
Note:: Support for Neon's serverless driver is available from Prisma versions 5.4.2 and later.
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.
To get started, enable the driverAdapters
Preview feature in your Prisma schema:
// schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
Note: Make sure your connection string exists in your
.env
file. Refer to Neon's docs to learn how to retrieve your database's connection string.
DATABASE_URL="postgres://user:password@server.us-east-2.aws.neon.tech/neondb"
Generate Prisma Client:
npx prisma generate
Install the Prisma adapter for Neon's serverless driver, Neon's serverless driver and ws
packages:
npm install @prisma/adapter-neon
npm install @neondatabase/serverless
npm install ws
Update your Prisma Client instance to use the Neon serverless driver using a WebSocket connection:
// Import needed packages
import { Pool, neonConfig } from '@neondatabase/serverless'
import { PrismaNeon } from '@prisma/adapter-neon'
import { PrismaClient } from '@prisma/client'
import ws from 'ws'
// Setup
neonConfig.webSocketConstructor = ws
const connectionString = `${process.env.DATABASE_URL}`
// Init prisma client
const pool = new Pool({ connectionString })
const adapter = new PrismaNeon(pool)
const prisma = new PrismaClient({ adapter })
// Use Prisma Client as normal
You can now use Prisma Client as you normally would with full type-safety. Your Prisma Client instance now uses Neon's serverless driver to connect to your database. This comes with benefits such as WebSocket connections and message pipelining.
We encourage you to create an issue if you find something missing or run into a bug.
If you have any feedback, leave a comment in this GitHub discussion.
FAQs
Prisma's driver adapter for "@neondatabase/serverless"
The npm package @prisma/adapter-neon receives a total of 13,291 weekly downloads. As such, @prisma/adapter-neon popularity was classified as popular.
We found that @prisma/adapter-neon demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.