neondatabase / neondatabase/serverless

Pool constructor confusing for Cloudflare Workers

Open
#205 1 comment 0 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

I couldn't figure out the right way to use @neondatabase/serverless with pg.Pool on Cloudflare Workers. The docs aren't clear on whether I should pass the connection string directly or as an object.

I tried both:

// Option 1
new Pool({ connectionString: process.env.DATABASE_URL })

// Option 2
new Pool(process.env.DATABASE_URL)

Both gave me issues when I tried creating the Pool at module scope. I ended up having to create it per-request like I did with auth, but I'm not sure if that's the intended pattern or if I'm doing it wrong.

Some clarification in the docs about Cloudflare Workers usage would be really helpful.

Version: 1.0.2
Database: Neon PostgreSQL
Deployment: Cloudflare Workers

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

No file or test is named. Start by reviewing the Pool constructor documentation and the Cloudflare Workers usage guidance, focusing on connection-string forms and module-scope versus per-request creation. Done means the docs clearly state the supported constructor usage and intended Pool lifecycle for Neon PostgreSQL on Workers.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
cloud, databases, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.