cloudflare-hyperdrive
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCloudflare Hyperdrive
Cloudflare Hyperdrive
Status: Production Ready ✅
Last Updated: 2026-01-09
Dependencies: cloudflare-worker-base (recommended for Worker setup)
Latest Versions: wrangler@4.58.0, pg@8.16.3+ (minimum), postgres@3.4.8, mysql2@3.16.0
Recent Updates (2025):
- July 2025: Configurable connection counts (min 5, max ~20 Free/~100 Paid)
- May 2025: 5x faster cache hits (regional prepared statement caching), FedRAMP Moderate authorization
- April 2025: Free plan availability (10 configs), MySQL GA support
- March 2025: 90% latency reduction (pools near database), IP access control (standard CF IP ranges)
- nodejs_compat_v2: pg driver no longer requires node_compat mode (auto-enabled with compatibility_date 2024-09-23+)
- Limits: 25 Hyperdrive configurations per account (Paid), 10 per account (Free)
状态:已就绪可用于生产环境 ✅
最后更新:2026-01-09
依赖项:cloudflare-worker-base(推荐用于Worker环境搭建)
最新版本:wrangler@4.58.0,pg@8.16.3+(最低要求),postgres@3.4.8,mysql2@3.16.0
2025年更新记录:
- 2025年7月:可配置连接数(免费版最低5个,最高约20个;付费版最高约100个)
- 2025年5月:缓存命中速度提升5倍(区域级预编译语句缓存),获得FedRAMP Moderate授权
- 2025年4月:免费版可用(支持10个配置),MySQL正式版(GA)支持
- 2025年3月:延迟降低90%(连接池部署在数据库附近),IP访问控制(支持标准Cloudflare IP段)
- nodejs_compat_v2:pg驱动不再需要node_compat模式(当compatibility_date设置为2024-09-23+时自动启用)
- 限制:付费账户最多可创建25个Hyperdrive配置,免费账户最多10个
Quick Start (5 Minutes)
快速开始(5分钟)
1. Create Hyperdrive Configuration
1. 创建Hyperdrive配置
bash
undefinedbash
undefinedFor PostgreSQL
针对PostgreSQL
npx wrangler hyperdrive create my-postgres-db
--connection-string="postgres://user:password@db-host.cloud:5432/database"
--connection-string="postgres://user:password@db-host.cloud:5432/database"
npx wrangler hyperdrive create my-postgres-db
--connection-string="postgres://user:password@db-host.cloud:5432/database"
--connection-string="postgres://user:password@db-host.cloud:5432/database"
For MySQL
针对MySQL
npx wrangler hyperdrive create my-mysql-db
--connection-string="mysql://user:password@db-host.cloud:3306/database"
--connection-string="mysql://user:password@db-host.cloud:3306/database"
npx wrangler hyperdrive create my-mysql-db
--connection-string="mysql://user:password@db-host.cloud:3306/database"
--connection-string="mysql://user:password@db-host.cloud:3306/database"
Output:
输出:
✅ Successfully created Hyperdrive configuration
✅ 成功创建Hyperdrive配置
[[hyperdrive]]
[[hyperdrive]]
binding = "HYPERDRIVE"
binding = "HYPERDRIVE"
id = "a76a99bc-7901-48c9-9c15-c4b11b559606"
id = "a76a99bc-7901-48c9-9c15-c4b11b559606"
**Save the `id` value** - you'll need it in the next step!
---
**保存`id`值** - 下一步需要用到它!
---2. Configure Bindings in wrangler.jsonc
2. 在wrangler.jsonc中配置绑定
Add to your :
wrangler.jsoncjsonc
{
"name": "my-worker",
"main": "src/index.ts",
"compatibility_date": "2024-09-23",
"compatibility_flags": ["nodejs_compat"], // REQUIRED for database drivers
"hyperdrive": [
{
"binding": "HYPERDRIVE", // Available as env.HYPERDRIVE
"id": "a76a99bc-7901-48c9-9c15-c4b11b559606" // From wrangler hyperdrive create
}
]
}CRITICAL:
- flag is REQUIRED for all database drivers
nodejs_compat - is how you access Hyperdrive in code (
binding)env.HYPERDRIVE - is the Hyperdrive configuration ID (NOT your database ID)
id
将以下内容添加到你的:
wrangler.jsoncjsonc
{
"name": "my-worker",
"main": "src/index.ts",
"compatibility_date": "2024-09-23",
"compatibility_flags": ["nodejs_compat"], // 数据库驱动必填
"hyperdrive": [
{
"binding": "HYPERDRIVE", // 在代码中通过env.HYPERDRIVE访问
"id": "a76a99bc-7901-48c9-9c15-c4b11b559606" // 来自wrangler hyperdrive create的输出
}
]
}关键注意事项:
- 标志是所有数据库驱动的必填项
nodejs_compat - 是你在代码中访问Hyperdrive的方式(
binding)env.HYPERDRIVE - 是Hyperdrive配置ID(而非你的数据库ID)
id
3. Install Database Driver
3. 安装数据库驱动
bash
undefinedbash
undefinedFor PostgreSQL (choose one)
针对PostgreSQL(二选一)
npm install pg # node-postgres (most common)
npm install postgres # postgres.js (modern, minimum v3.4.5)
npm install pg # node-postgres(最常用)
npm install postgres # postgres.js(现代驱动,最低要求v3.4.5)
For MySQL
针对MySQL
npm install mysql2 # mysql2 (minimum v3.13.0)
---npm install mysql2 # mysql2(最低要求v3.13.0)
---4. Query Your Database
4. 查询数据库
PostgreSQL with node-postgres (pg):
typescript
import { Client } from "pg";
type Bindings = {
HYPERDRIVE: Hyperdrive;
};
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const client = new Client({
connectionString: env.HYPERDRIVE.connectionString
});
await client.connect();
try {
const result = await client.query('SELECT * FROM users LIMIT 10');
return Response.json({ users: result.rows });
} finally {
// Clean up connection AFTER response is sent
ctx.waitUntil(client.end());
}
}
};MySQL with mysql2:
typescript
import { createConnection } from "mysql2/promise";
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const connection = await createConnection({
host: env.HYPERDRIVE.host,
user: env.HYPERDRIVE.user,
password: env.HYPERDRIVE.password,
database: env.HYPERDRIVE.database,
port: env.HYPERDRIVE.port,
disableEval: true // REQUIRED for Workers (eval() not supported)
});
try {
const [rows] = await connection.query('SELECT * FROM users LIMIT 10');
return Response.json({ users: rows });
} finally {
ctx.waitUntil(connection.end());
}
}
};使用node-postgres(pg)连接PostgreSQL:
typescript
import { Client } from "pg";
type Bindings = {
HYPERDRIVE: Hyperdrive;
};
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const client = new Client({
connectionString: env.HYPERDRIVE.connectionString
});
await client.connect();
try {
const result = await client.query('SELECT * FROM users LIMIT 10');
return Response.json({ users: result.rows });
} finally {
// 响应发送后再清理连接
ctx.waitUntil(client.end());
}
}
};使用mysql2连接MySQL:
typescript
import { createConnection } from "mysql2/promise";
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const connection = await createConnection({
host: env.HYPERDRIVE.host,
user: env.HYPERDRIVE.user,
password: env.HYPERDRIVE.password,
database: env.HYPERDRIVE.database,
port: env.HYPERDRIVE.port,
disableEval: true // Workers环境必填(不支持eval())
});
try {
const [rows] = await connection.query('SELECT * FROM users LIMIT 10');
return Response.json({ users: rows });
} finally {
ctx.waitUntil(connection.end());
}
}
};5. Deploy
5. 部署
bash
npx wrangler deployThat's it! Your Worker now connects to your existing database via Hyperdrive with:
- ✅ Global connection pooling
- ✅ Automatic query caching
- ✅ Reduced latency (eliminates 7 round trips)
bash
npx wrangler deploy完成! 你的Worker现在通过Hyperdrive连接到现有数据库,具备以下特性:
- ✅ 全局连接池
- ✅ 自动查询缓存
- ✅ 延迟降低(减少7次往返请求)
Known Issues Prevention
已知问题预防
This skill prevents 11 documented issues with sources and solutions.
本指南可预防11种有记录的问题,并提供来源与解决方案。
Issue #1: Windows/macOS Local Development - Hostname Resolution Failure
问题1:Windows/macOS本地开发 - 主机名解析失败
Error: Connection fails with hostname like
Source: GitHub Issue #11556
Platforms: Windows, macOS 26 Tahoe, Ubuntu 24.04 LTS (wrangler@4.54.0+)
Why It Happens: Hyperdrive local proxy hostname fails to resolve on certain platforms
Prevention:
xxx.hyperdrive.localUse environment variable for local development:
bash
export CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE="postgres://user:password@localhost:5432/db"
npx wrangler devOr use (caution: uses production database)
wrangler dev --remoteStatus: Open issue, workaround available
错误:使用这类主机名时连接失败
来源:GitHub Issue #11556
受影响平台:Windows、macOS 26 Tahoe、Ubuntu 24.04 LTS(wrangler@4.54.0+)
问题原因:Hyperdrive本地代理主机名在部分平台上无法解析
解决方法:
xxx.hyperdrive.local在本地开发时使用环境变量:
bash
export CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE="postgres://user:password@localhost:5432/db"
npx wrangler dev或使用(注意:会连接生产数据库)
wrangler dev --remote状态:问题仍未解决,已有可用 workaround
Issue #2: postgres.js Hangs with IP Addresses
问题2:postgres.js使用IP地址时连接挂起
Error: Connection hangs indefinitely with no error message
Source: GitHub Issue #6179
Why It Happens: Using IP address instead of hostname in connection string causes postgres.js to hang
Prevention:
typescript
// ❌ WRONG - IP address causes indefinite hang
const connection = "postgres://user:password@192.168.1.100:5432/db"
// ✅ CORRECT - Use hostname
const connection = "postgres://user:password@db.example.com:5432/db"Additional Gotcha: Miniflare (local dev) only supports A-z0-9 characters in passwords, despite Postgres allowing special characters. Use simple passwords for local development.
错误:连接无限期挂起,无错误提示
来源:GitHub Issue #6179
问题原因:连接字符串中使用IP地址而非主机名会导致postgres.js挂起
解决方法:
typescript
// ❌ 错误用法 - IP地址会导致无限期挂起
const connection = "postgres://user:password@192.168.1.100:5432/db"
// ✅ 正确用法 - 使用主机名
const connection = "postgres://user:password@db.example.com:5432/db"额外注意:Miniflare(本地开发工具)仅支持密码中包含A-z0-9字符,尽管Postgres允许特殊字符。本地开发时请使用简单密码。
Issue #3: MySQL 8.0.43 Authentication Plugin Not Supported
问题3:MySQL 8.0.43的认证插件不被支持
Error: "unsupported authentication method"
Source: GitHub Issue #10617
Why It Happens: MySQL 8.0.43+ introduces new authentication method not supported by Hyperdrive
Prevention:
Use MySQL 8.0.40 or earlier, or configure user to use supported auth plugin:
sql
ALTER USER 'username'@'%' IDENTIFIED WITH caching_sha2_password BY 'password';Supported Auth Plugins: Only and
Status: Known issue tracked as CFSQL-1392
caching_sha2_passwordmysql_native_password错误:"unsupported authentication method"
来源:GitHub Issue #10617
问题原因:MySQL 8.0.43+引入的新认证方法不被Hyperdrive支持
解决方法:
使用MySQL 8.0.40或更早版本,或配置用户使用支持的认证插件:
sql
ALTER USER 'username'@'%' IDENTIFIED WITH caching_sha2_password BY 'password';支持的认证插件:仅和
状态:已知问题,跟踪编号CFSQL-1392
caching_sha2_passwordmysql_native_passwordIssue #4: Local SSL/TLS Not Supported for Remote Databases
问题4:本地开发时不支持远程数据库的SSL/TLS连接
Error: SSL required but connection fails in local development
Source: GitHub Issue #10124
Why It Happens: Hyperdrive local mode doesn't support SSL connections to remote databases (e.g., Neon, cloud providers)
Prevention:
Use conditional connection in code:
typescript
const url = env.isLocal ? env.DB_URL : env.HYPERDRIVE.connectionString;
const client = postgres(url, {
fetch_types: false,
max: 2,
});Alternative: Use (⚠️ connects to production database)
Timeline: SSL support planned for 2026 (requires workerd/Workers runtime changes, tracked as SQC-645)
wrangler dev --remote错误:本地开发时需要SSL但连接失败
来源:GitHub Issue #10124
问题原因:Hyperdrive本地模式不支持与远程数据库的SSL连接(如Neon、云厂商数据库)
解决方法:
在代码中使用条件连接:
typescript
const url = env.isLocal ? env.DB_URL : env.HYPERDRIVE.connectionString;
const client = postgres(url, {
fetch_types: false,
max: 2,
});替代方案:使用(⚠️ 会连接生产数据库)
时间线:计划2026年支持SSL(需要workerd/Workers运行时变更,跟踪编号SQC-645)
wrangler dev --remoteIssue #5: Transaction Mode Resets SET Statements Between Queries
问题5:事务模式会重置查询间的SET语句
Error: SET statements don't persist across queries
Source: Cloudflare Hyperdrive Docs - How Hyperdrive Works
Why It Happens: Hyperdrive operates in transaction mode where connections are returned to pool after each transaction and RESET
Prevention:
typescript
// ❌ WRONG - SET won't persist across queries
await client.query('SET search_path TO myschema');
await client.query('SELECT * FROM mytable'); // Uses default search_path!
// ✅ CORRECT - SET within transaction
await client.query('BEGIN');
await client.query('SET search_path TO myschema');
await client.query('SELECT * FROM mytable'); // Now uses myschema
await client.query('COMMIT');⚠️ WARNING: Wrapping multiple operations in a single transaction to maintain SET state will affect Hyperdrive's performance and scaling.
错误:SET语句无法在查询间持久化
来源:Cloudflare Hyperdrive文档 - Hyperdrive工作原理
问题原因:Hyperdrive运行在事务模式下,每个事务完成后连接会返回连接池并被重置
解决方法:
typescript
// ❌ 错误用法 - SET语句无法在查询间持久化
await client.query('SET search_path TO myschema');
await client.query('SELECT * FROM mytable'); // 使用的是默认search_path!
// ✅ 正确用法 - 在事务中执行SET
await client.query('BEGIN');
await client.query('SET search_path TO myschema');
await client.query('SELECT * FROM mytable'); // 现在使用的是myschema
await client.query('COMMIT');⚠️ 警告:为了保持SET状态而将多个操作包裹在单个事务中,会影响Hyperdrive的性能与扩展性。
Issue #6: Prisma Client Reuse Causes Hangs in Workers (Community-sourced)
问题6:Workers中重用Prisma Client导致挂起(社区反馈)
Error: Worker hangs and times out after first request
Source: GitHub Issue #28193
Verified: Multiple users confirmed
Why It Happens: Prisma's connection pool attempts to reuse connections across request contexts, violating Workers' I/O isolation
Prevention:
typescript
// ❌ WRONG - Global Prisma client reused across requests
const prisma = new PrismaClient({ adapter });
export default {
async fetch(request: Request, env: Bindings) {
// First request: works
// Subsequent requests: hang indefinitely
const users = await prisma.user.findMany();
return Response.json({ users });
}
};
// ✅ CORRECT - Create new client per request
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const pool = new Pool({
connectionString: env.HYPERDRIVE.connectionString,
max: 5
});
const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });
try {
const users = await prisma.user.findMany();
return Response.json({ users });
} finally {
ctx.waitUntil(pool.end());
}
}
};错误:首次请求正常,后续请求挂起并超时
来源:GitHub Issue #28193
已验证:多位用户确认该问题
问题原因:Prisma的连接池尝试跨请求上下文重用连接,违反了Workers的I/O隔离原则
解决方法:
typescript
// ❌ 错误用法 - 全局Prisma Client跨请求重用
const prisma = new PrismaClient({ adapter });
export default {
async fetch(request: Request, env: Bindings) {
// 首次请求:正常工作
// 后续请求:无限期挂起
const users = await prisma.user.findMany();
return Response.json({ users });
}
};
// ✅ 正确用法 - 每个请求创建新的Client
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const pool = new Pool({
connectionString: env.HYPERDRIVE.connectionString,
max: 5
});
const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });
try {
const users = await prisma.user.findMany();
return Response.json({ users });
} finally {
ctx.waitUntil(pool.end());
}
}
};Issue #7: Neon Serverless Driver Incompatible with Hyperdrive (Community-sourced)
问题7:Neon Serverless Driver与Hyperdrive不兼容(社区反馈)
Error: Hyperdrive provides no benefit with Neon serverless driver
Source: Neon GitHub Repo, Cloudflare Docs
Why It Happens: Neon's serverless driver uses WebSockets instead of TCP, bypassing Hyperdrive's connection pooling
Prevention:
typescript
// ❌ WRONG - Neon serverless driver bypasses Hyperdrive
import { neon } from '@neondatabase/serverless';
const sql = neon(env.HYPERDRIVE.connectionString);
// This uses WebSockets, not TCP - Hyperdrive doesn't help
// ✅ CORRECT - Use traditional TCP driver with Hyperdrive
import postgres from 'postgres';
const sql = postgres(env.HYPERDRIVE.connectionString, {
prepare: true,
max: 5
});Official Recommendation: Neon documentation states "On Cloudflare Workers, consider using Cloudflare Hyperdrive instead of this driver"
错误:使用Neon serverless driver时Hyperdrive无法提供任何优势
来源:Neon GitHub仓库, Cloudflare文档
问题原因:Neon的serverless driver使用WebSocket而非TCP,绕过了Hyperdrive的连接池
解决方法:
typescript
// ❌ 错误用法 - Neon serverless driver绕过Hyperdrive
import { neon } from '@neondatabase/serverless';
const sql = neon(env.HYPERDRIVE.connectionString);
// 此方式使用WebSocket而非TCP - Hyperdrive无法发挥作用
// ✅ 正确用法 - 使用传统TCP驱动配合Hyperdrive
import postgres from 'postgres';
const sql = postgres(env.HYPERDRIVE.connectionString, {
prepare: true,
max: 5
});官方建议:Neon文档指出“在Cloudflare Workers上,考虑使用Cloudflare Hyperdrive而非此驱动”
Issue #8: Supabase - Must Use Direct Connection String, Not Pooled (Community-sourced)
问题8:Supabase必须使用直接连接字符串,而非池化连接(社区反馈)
Error: Double-pooling causes connection issues
Source: Cloudflare Docs - Supabase
Why It Happens: Using Supabase pooled connection (Supavisor) creates double-pooling; Supavisor doesn't support prepared statements
Prevention:
bash
undefined错误:双重池化导致连接问题
来源:Cloudflare文档 - Supabase
问题原因:使用Supabase池化连接(Supavisor)会造成双重池化;Supavisor不支持预编译语句
解决方法:
bash
undefined❌ WRONG - Using Supabase pooled connection (Supavisor)
❌ 错误用法 - 使用Supabase池化连接(Supavisor)
npx wrangler hyperdrive create my-supabase
--connection-string="postgres://user:password@aws-0-us-west-1.pooler.supabase.com:6543/postgres"
--connection-string="postgres://user:password@aws-0-us-west-1.pooler.supabase.com:6543/postgres"
npx wrangler hyperdrive create my-supabase
--connection-string="postgres://user:password@aws-0-us-west-1.pooler.supabase.com:6543/postgres"
--connection-string="postgres://user:password@aws-0-us-west-1.pooler.supabase.com:6543/postgres"
✅ CORRECT - Use Supabase direct connection
✅ 正确用法 - 使用Supabase直接连接
npx wrangler hyperdrive create my-supabase
--connection-string="postgres://user:password@db.projectref.supabase.co:5432/postgres"
--connection-string="postgres://user:password@db.projectref.supabase.co:5432/postgres"
**Reason**: Hyperdrive provides its own pooling; double-pooling causes issues and breaks caching
---npx wrangler hyperdrive create my-supabase
--connection-string="postgres://user:password@db.projectref.supabase.co:5432/postgres"
--connection-string="postgres://user:password@db.projectref.supabase.co:5432/postgres"
**原因**:Hyperdrive已提供自身的池化功能;双重池化会导致问题并破坏缓存
---Issue #9: Drizzle ORM with Nitro 3 - 95% Failure Rate with useDatabase (Community-sourced)
问题9:Nitro 3的useDatabase与Drizzle、Hyperdrive配合时失败率达95%(社区反馈)
Error: 500 errors approximately 95% of the time
Source: GitHub Issue #3893
Verified: Reproduced by multiple users
Why It Happens: Nitro 3's built-in (db0/integrations/drizzle) has I/O isolation issues
Prevention:
useDatabasetypescript
// ❌ WRONG - Nitro's useDatabase fails ~95% of the time
import { useDatabase } from 'db0';
import { drizzle } from 'db0/integrations/drizzle';
export default eventHandler(async () => {
const db = useDatabase();
const users = await drizzle(db).select().from(usersTable);
// Fails ~95% of the time with 500 error
});
// ✅ CORRECT - Create Drizzle client directly
import postgres from 'postgres';
import { drizzle } from 'drizzle-orm/postgres-js';
export default eventHandler(async (event) => {
const sql = postgres(event.context.cloudflare.env.HYPERDRIVE.connectionString, {
max: 5,
prepare: true
});
const db = drizzle(sql);
const users = await db.select().from(usersTable);
event.context.cloudflare.ctx.waitUntil(sql.end());
return { users };
});Error Message: "Cannot perform I/O on behalf of a different request"
错误:约95%的请求返回500错误
来源:GitHub Issue #3893
已验证:多位用户复现该问题
问题原因:Nitro 3内置的(db0/integrations/drizzle)存在I/O隔离问题
解决方法:
useDatabasetypescript
// ❌ 错误用法 - Nitro的useDatabase失败率约95%
import { useDatabase } from 'db0';
import { drizzle } from 'db0/integrations/drizzle';
export default eventHandler(async () => {
const db = useDatabase();
const users = await drizzle(db).select().from(usersTable);
// 约95%的概率返回500错误
});
// ✅ 正确用法 - 直接创建Drizzle客户端
import postgres from 'postgres';
import { drizzle } from 'drizzle-orm/postgres-js';
export default eventHandler(async (event) => {
const sql = postgres(event.context.cloudflare.env.HYPERDRIVE.connectionString, {
max: 5,
prepare: true
});
const db = drizzle(sql);
const users = await db.select().from(usersTable);
event.context.cloudflare.ctx.waitUntil(sql.end());
return { users };
});错误信息:"Cannot perform I/O on behalf of a different request"
Issue #10: postgres.js Version Requirements for Caching (Community-sourced)
问题10:postgres.js版本要求(社区反馈)
Error: Prepared statement caching doesn't work properly
Source: Cloudflare Docs
Why It Happens: postgres.js versions before 3.4.5 don't support Hyperdrive's prepared statement caching properly
Prevention:
bash
undefined错误:预编译语句缓存无法正常工作
来源:Cloudflare文档
问题原因:3.4.5之前的postgres.js版本无法正常支持Hyperdrive的预编译语句缓存
解决方法:
bash
undefinedMinimum version for Hyperdrive compatibility
Hyperdrive兼容的最低版本
npm install postgres@3.4.5
npm install postgres@3.4.5
Current recommended version
当前推荐版本
npm install postgres@3.4.8
**Related**: May 2025 prepared statement caching improvements require minimum version 3.4.5
---npm install postgres@3.4.8
**相关更新**:2025年5月的预编译语句缓存优化要求最低版本3.4.5
---Issue #11: WebSocket-Based Database Drivers Not Compatible
问题11:基于WebSocket的数据库驱动不兼容
Error: Hyperdrive provides no benefit or causes connection issues
Source: General pattern from Neon serverless driver issue
Why It Happens: Hyperdrive requires TCP connections; WebSocket-based drivers bypass the TCP pooling layer
Prevention:
Use traditional TCP-based drivers (pg, postgres.js, mysql2) instead of WebSocket-based drivers.
Affected Drivers: Any database driver using WebSockets instead of TCP
错误:Hyperdrive无法提供优势或导致连接问题
来源:Neon serverless driver问题的通用模式
问题原因:Hyperdrive需要TCP连接;基于WebSocket的驱动会绕过TCP池化层
解决方法:
使用传统的TCP驱动(pg、postgres.js、mysql2)替代基于WebSocket的驱动。
受影响驱动:所有使用WebSocket而非TCP的数据库驱动
How Hyperdrive Works
Hyperdrive工作原理
Hyperdrive eliminates 7 connection round trips (TCP + TLS + auth) by:
- Edge connection setup near Worker (low latency)
- Connection pooling near database (March 2025: 90% latency reduction)
- Query caching at edge (May 2025: 5x faster cache hits)
Result: Single-region databases feel globally distributed.
Hyperdrive通过以下方式减少7次连接往返请求(TCP + TLS + 认证):
- 在Worker附近的边缘节点建立连接(低延迟)
- 在数据库附近部署连接池(2025年3月:延迟降低90%)
- 在边缘节点缓存查询结果(2025年5月:缓存命中速度提升5倍)
效果:单区域数据库可实现全局分布式的访问体验。
Setup Steps
详细设置步骤
Prerequisites
前置条件
- Cloudflare account with Workers access
- PostgreSQL (v9.0-17.x) or MySQL (v5.7-8.x) database
- Database accessible via public internet (TLS/SSL required) or private network (Cloudflare Tunnel)
- April 2025: Available on Free plan (10 configs) and Paid plan (25 configs)
- 拥有Cloudflare账户并可访问Workers服务
- PostgreSQL(v9.0-17.x)或MySQL(v5.7-8.x)数据库
- 数据库可通过公网访问(要求TLS/SSL)或通过私有网络(Cloudflare Tunnel)访问
- 2025年4月起:免费版(支持10个配置)与付费版(支持25个配置)均可用
Connection String Formats
连接字符串格式
bash
undefinedbash
undefinedPostgreSQL
PostgreSQL
postgres://user:password@host:5432/database
postgres://user:password@host:5432/database?sslmode=require
postgres://user:password@host:5432/database
postgres://user:password@host:5432/database?sslmode=require
MySQL
MySQL
mysql://user:password@host:3306/database
mysql://user:password@host:3306/database
URL-encode special chars: p@ssw$rd → p%40ssw%24rd
特殊字符需URL编码:p@ssw$rd → p%40ssw%24rd
---
---Connection Patterns
连接模式
Single Connection (pg.Client)
单连接(pg.Client)
typescript
const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
await client.connect();
const result = await client.query('SELECT ...');
ctx.waitUntil(client.end()); // CRITICAL: Non-blocking cleanupUse for: Simple queries, single query per request
typescript
const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
await client.connect();
const result = await client.query('SELECT ...');
ctx.waitUntil(client.end()); // 关键:非阻塞式清理适用场景:简单查询,每个请求仅执行一次查询
Connection Pool (pg.Pool)
连接池(pg.Pool)
typescript
const pool = new Pool({
connectionString: env.HYPERDRIVE.connectionString,
max: 5 // CRITICAL: Workers limit is 6 connections (July 2025: configurable ~20 Free, ~100 Paid)
});
const [result1, result2] = await Promise.all([
pool.query('SELECT ...'),
pool.query('SELECT ...')
]);
ctx.waitUntil(pool.end());Use for: Parallel queries in single request
typescript
const pool = new Pool({
connectionString: env.HYPERDRIVE.connectionString,
max: 5 // 关键:Workers限制为6个连接(2025年7月起:免费版最高约20个,付费版最高约100个)
});
const [result1, result2] = await Promise.all([
pool.query('SELECT ...'),
pool.query('SELECT ...')
]);
ctx.waitUntil(pool.end());适用场景:单个请求中执行并行查询
Connection Cleanup Rule
连接清理规则
ALWAYS use - non-blocking cleanup after response sent
NEVER use - blocks response, adds latency
ctx.waitUntil(client.end())await client.end()务必使用 - 响应发送后再进行非阻塞式清理
绝对不要使用 - 会阻塞响应发送,增加延迟
ctx.waitUntil(client.end())await client.end()ORM Integration
ORM集成
Drizzle ORM
Drizzle ORM
typescript
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
const sql = postgres(env.HYPERDRIVE.connectionString, { max: 5 });
const db = drizzle(sql);
const allUsers = await db.select().from(users);
ctx.waitUntil(sql.end());typescript
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
const sql = postgres(env.HYPERDRIVE.connectionString, { max: 5 });
const db = drizzle(sql);
const allUsers = await db.select().from(users);
ctx.waitUntil(sql.end());Prisma ORM
Prisma ORM
⚠️ CRITICAL: Do NOT reuse Prisma client across requests in Workers. Create new client per request.
typescript
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@prisma/client";
import { Pool } from "pg";
// ❌ WRONG - Global client causes hangs after first request
const prisma = new PrismaClient({ adapter });
export default {
async fetch(request: Request, env: Bindings) {
const users = await prisma.user.findMany(); // Hangs after first request
return Response.json({ users });
}
};
// ✅ CORRECT - Per-request client
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const pool = new Pool({ connectionString: env.HYPERDRIVE.connectionString, max: 5 });
const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });
try {
const users = await prisma.user.findMany();
return Response.json({ users });
} finally {
ctx.waitUntil(pool.end());
}
}
};Why: Prisma's connection pool attempts to reuse connections across request contexts, violating Workers' I/O isolation. Source: GitHub Issue #28193
Note: Prisma requires driver adapters ().
@prisma/adapter-pg⚠️ 关键注意事项:在Workers中绝对不要跨请求重用Prisma Client。每个请求创建新的Client。
typescript
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "@prisma/client";
import { Pool } from "pg";
// ❌ 错误用法 - 全局Client会导致首次请求后挂起
const prisma = new PrismaClient({ adapter });
export default {
async fetch(request: Request, env: Bindings) {
const users = await prisma.user.findMany(); // 首次请求后挂起
return Response.json({ users });
}
};
// ✅ 正确用法 - 每个请求创建新的Client
export default {
async fetch(request: Request, env: Bindings, ctx: ExecutionContext) {
const pool = new Pool({ connectionString: env.HYPERDRIVE.connectionString, max: 5 });
const adapter = new PrismaPg(pool);
const prisma = new PrismaClient({ adapter });
try {
const users = await prisma.user.findMany();
return Response.json({ users });
} finally {
ctx.waitUntil(pool.end());
}
}
};原因:Prisma的连接池尝试跨请求上下文重用连接,违反了Workers的I/O隔离原则。来源:GitHub Issue #28193
注意:Prisma需要驱动适配器(如)。
@prisma/adapter-pgLocal Development
本地开发
⚠️ SSL/TLS Limitations in Local Development
⚠️ 本地开发的SSL/TLS限制
Important: Local Hyperdrive connections do NOT support SSL. This affects databases that require SSL (e.g., Neon, most cloud providers).
Workaround - Conditional Connection:
typescript
const url = env.isLocal ? env.DB_URL : env.HYPERDRIVE.connectionString;
const client = postgres(url, {
fetch_types: false,
max: 2,
});Alternative: Use (⚠️ connects to production database)
wrangler dev --remoteTimeline: SSL support planned for 2026 (requires workerd/Workers runtime changes)
Source: GitHub Issue #10124, tracked as SQC-645
重要提示:本地Hyperdrive连接不支持SSL。这会影响要求SSL的数据库(如Neon、多数云厂商数据库)。
Workaround - 条件连接:
typescript
const url = env.isLocal ? env.DB_URL : env.HYPERDRIVE.connectionString;
const client = postgres(url, {
fetch_types: false,
max: 2,
});替代方案:使用(⚠️ 会连接生产数据库)
wrangler dev --remote时间线:计划2026年支持SSL(需要workerd/Workers运行时变更)
来源:GitHub Issue #10124,跟踪编号SQC-645
Local Connection Options
本地连接选项
Option 1: Environment Variable (Recommended)
bash
export CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE="postgres://user:password@localhost:5432/local_db"
npx wrangler devSafe to commit config, no credentials in wrangler.jsonc.
Option 2: localConnectionString in wrangler.jsonc
jsonc
{ "hyperdrive": [{ "binding": "HYPERDRIVE", "id": "prod-id", "localConnectionString": "postgres://..." }] }⚠️ Don't commit credentials to version control.
Option 3: Remote Development
bash
npx wrangler dev --remote # ⚠️ Uses PRODUCTION database选项1:环境变量(推荐)
bash
export CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE="postgres://user:password@localhost:5432/local_db"
npx wrangler dev配置可安全提交,凭证不会出现在wrangler.jsonc中。
选项2:在wrangler.jsonc中设置localConnectionString
jsonc
{ "hyperdrive": [{ "binding": "HYPERDRIVE", "id": "prod-id", "localConnectionString": "postgres://..." }] }⚠️ 不要将凭证提交到版本控制系统。
选项3:远程开发
bash
npx wrangler dev --remote # ⚠️ 使用生产数据库Query Caching
查询缓存
Cached: SELECT (non-mutating queries)
NOT Cached: INSERT, UPDATE, DELETE, volatile functions (LASTVAL, LAST_INSERT_ID)
May 2025: 5x faster cache hits via regional prepared statement caching.
Critical for postgres.js:
typescript
const sql = postgres(env.HYPERDRIVE.connectionString, {
prepare: true // REQUIRED for caching
});Check cache status:
typescript
response.headers.get('cf-cache-status'); // HIT, MISS, BYPASS, EXPIRED可缓存:SELECT(非修改类查询)
不可缓存:INSERT、UPDATE、DELETE、易变函数(LASTVAL、LAST_INSERT_ID)
2025年5月更新:通过区域级预编译语句缓存,缓存命中速度提升5倍。
postgres.js关键配置:
typescript
const sql = postgres(env.HYPERDRIVE.connectionString, {
prepare: true // 缓存功能必填
});检查缓存状态:
typescript
response.headers.get('cf-cache-status'); // HIT、MISS、BYPASS、EXPIREDTLS/SSL Configuration
TLS/SSL配置
SSL Modes: (default), (verify CA), (verify CA + hostname)
requireverify-caverify-fullServer Certificates (verify-ca/verify-full):
bash
npx wrangler cert upload certificate-authority --ca-cert root-ca.pem --name my-ca-cert
npx wrangler hyperdrive create my-db --connection-string="postgres://..." --ca-certificate-id <ID> --sslmode verify-fullClient Certificates (mTLS):
bash
npx wrangler cert upload mtls-certificate --cert client-cert.pem --key client-key.pem --name my-cert
npx wrangler hyperdrive create my-db --connection-string="postgres://..." --mtls-certificate-id <ID>SSL模式:(默认)、(验证CA证书)、(验证CA证书与主机名)
requireverify-caverify-full服务器证书(verify-ca/verify-full):
bash
npx wrangler cert upload certificate-authority --ca-cert root-ca.pem --name my-ca-cert
npx wrangler hyperdrive create my-db --connection-string="postgres://..." --ca-certificate-id <ID> --sslmode verify-full客户端证书(mTLS):
bash
npx wrangler cert upload mtls-certificate --cert client-cert.pem --key client-key.pem --name my-cert
npx wrangler hyperdrive create my-db --connection-string="postgres://..." --mtls-certificate-id <ID>Private Database Access (Cloudflare Tunnel)
私有数据库访问(Cloudflare Tunnel)
Connect to databases in private networks (VPCs, on-premises):
bash
undefined连接私有网络(VPC、本地机房)中的数据库:
bash
undefined1. Install cloudflared (macOS: brew install cloudflare/cloudflare/cloudflared)
1. 安装cloudflared(macOS:brew install cloudflare/cloudflare/cloudflared)
2. Create tunnel
2. 创建隧道
cloudflared tunnel create my-db-tunnel
cloudflared tunnel create my-db-tunnel
3. Configure config.yml
3. 配置config.yml
tunnel: <TUNNEL_ID>
tunnel: <TUNNEL_ID>
ingress:
ingress:
- hostname: db.example.com
- hostname: db.example.com
service: tcp://localhost:5432
service: tcp://localhost:5432
4. Run tunnel
4. 运行隧道
cloudflared tunnel run my-db-tunnel
cloudflared tunnel run my-db-tunnel
5. Create Hyperdrive
5. 创建Hyperdrive
npx wrangler hyperdrive create my-private-db --connection-string="postgres://user:password@db.example.com:5432/database"
---npx wrangler hyperdrive create my-private-db --connection-string="postgres://user:password@db.example.com:5432/database"
---Critical Rules
核心规则
Always Do
务必遵守
✅ Include in
✅ Use for connection cleanup
✅ Set for connection pools (Workers limit: 6)
✅ Enable TLS/SSL on your database (Hyperdrive requires it)
✅ Use prepared statements for caching (postgres.js: )
✅ Set for mysql2 driver
✅ Handle errors gracefully with try/catch
✅ Use environment variables for local development connection strings
✅ Test locally with before deploying
nodejs_compatcompatibility_flagsctx.waitUntil(client.end())max: 5prepare: truedisableEval: truewrangler dev✅ 在中包含
✅ 使用进行连接清理
✅ 连接池的max值设置为5(Workers限制为6个连接)
✅ 为数据库启用TLS/SSL(Hyperdrive要求)
✅ 使用预编译语句以启用缓存(postgres.js需设置)
✅ 为mysql2驱动设置
✅ 使用try/catch优雅处理错误
✅ 使用环境变量存储本地开发的连接字符串
✅ 部署前使用进行本地测试
compatibility_flagsnodejs_compatctx.waitUntil(client.end())prepare: truedisableEval: truewrangler devNever Do
绝对禁止
❌ Skip flag (causes "No such module" errors)
❌ Use private IP addresses directly (use Cloudflare Tunnel instead)
❌ Use (blocks response, use )
❌ Set connection pool max > 5 (exceeds Workers' 6 connection limit)
❌ Wrap all queries in transactions (limits connection multiplexing)
❌ Use SQL-level PREPARE/EXECUTE/DEALLOCATE (unsupported)
❌ Use advisory locks, LISTEN/NOTIFY (PostgreSQL unsupported features)
❌ Use multi-statement queries in MySQL (unsupported)
❌ Commit database credentials to version control
❌ Use IP addresses in connection strings instead of hostnames (causes postgres.js to hang)
❌ Use Neon serverless driver with Hyperdrive (uses WebSockets, bypasses pooling)
❌ Use Supabase pooled connection string (Supavisor) with Hyperdrive (double-pooling)
❌ Reuse Prisma client instances across requests in Workers (causes hangs and timeouts)
❌ Use Nitro 3's with Drizzle and Hyperdrive (~95% failure rate)
❌ Expect SET statements to persist across queries (transaction mode resets connections)
❌ Use postgres.js versions before 3.4.5 (breaks prepared statement caching)
nodejs_compatawait client.end()ctx.waitUntil()useDatabase❌ 省略标志(会导致"No such module"错误)
❌ 直接使用私有IP地址(改用Cloudflare Tunnel)
❌ 使用(会阻塞响应,改用)
❌ 连接池max值设置大于5(超过Workers的6个连接限制)
❌ 将所有查询包裹在事务中(会限制连接多路复用)
❌ 使用SQL层面的PREPARE/EXECUTE/DEALLOCATE(不支持)
❌ 使用 advisory locks、LISTEN/NOTIFY(PostgreSQL不支持的特性)
❌ 在MySQL中使用多语句查询(不支持)
❌ 将数据库凭证提交到版本控制系统
❌ 连接字符串中使用IP地址而非主机名(会导致postgres.js挂起)
❌ 将Neon serverless driver与Hyperdrive配合使用(使用WebSocket,绕过池化)
❌ 将Supabase池化连接字符串(Supavisor)与Hyperdrive配合使用(双重池化)
❌ 在Workers中跨请求重用Prisma Client实例(会导致挂起与超时)
❌ 将Nitro 3的与Drizzle、Hyperdrive配合使用(失败率约95%)
❌ 期望SET语句在查询间持久化(事务模式会重置连接)
❌ 使用3.4.5之前的postgres.js版本(会破坏预编译语句缓存)
nodejs_compatawait client.end()ctx.waitUntil()useDatabaseWrangler Commands Reference
Wrangler命令参考
bash
undefinedbash
undefinedCreate Hyperdrive configuration
创建Hyperdrive配置
wrangler hyperdrive create <name> --connection-string="postgres://..."
wrangler hyperdrive create <name> --connection-string="postgres://..."
List all Hyperdrive configurations
列出所有Hyperdrive配置
wrangler hyperdrive list
wrangler hyperdrive list
Get details of a configuration
获取某一配置的详情
wrangler hyperdrive get <hyperdrive-id>
wrangler hyperdrive get <hyperdrive-id>
Update connection string
更新连接字符串
wrangler hyperdrive update <hyperdrive-id> --connection-string="postgres://..."
wrangler hyperdrive update <hyperdrive-id> --connection-string="postgres://..."
Delete configuration
删除配置
wrangler hyperdrive delete <hyperdrive-id>
wrangler hyperdrive delete <hyperdrive-id>
Upload CA certificate
上传CA证书
wrangler cert upload certificate-authority --ca-cert <file>.pem --name <name>
wrangler cert upload certificate-authority --ca-cert <file>.pem --name <name>
Upload client certificate pair
上传客户端证书对
wrangler cert upload mtls-certificate --cert <cert>.pem --key <key>.pem --name <name>
---wrangler cert upload mtls-certificate --cert <cert>.pem --key <key>.pem --name <name>
---Supported Databases
支持的数据库
PostgreSQL (v9.0-17.x): AWS RDS/Aurora, Google Cloud SQL, Azure, Neon, Supabase, PlanetScale, Timescale, CockroachDB, Materialize, Fly.io, pgEdge, Prisma Postgres
MySQL (v5.7-8.x): AWS RDS/Aurora, Google Cloud SQL, Azure, PlanetScale, MariaDB (April 2025 GA)
NOT Supported: SQL Server, MongoDB, Oracle
PostgreSQL(v9.0-17.x):AWS RDS/Aurora、Google Cloud SQL、Azure、Neon、Supabase、PlanetScale、Timescale、CockroachDB、Materialize、Fly.io、pgEdge、Prisma Postgres
MySQL(v5.7-8.x):AWS RDS/Aurora、Google Cloud SQL、Azure、PlanetScale、MariaDB(2025年4月正式支持)
不支持:SQL Server、MongoDB、Oracle
Unsupported Features
不支持的特性
PostgreSQL
PostgreSQL
- SQL-level prepared statements (,
PREPARE,EXECUTE)DEALLOCATE - Advisory locks
- and
LISTENNOTIFY - Per-session state modifications
- SQL层面的预编译语句(、
PREPARE、EXECUTE)DEALLOCATE - Advisory locks
- 与
LISTENNOTIFY - 会话级状态修改
MySQL
MySQL
- Non-UTF8 characters in queries
- statements
USE - Multi-statement queries
- Protocol-level prepared statements ()
COM_STMT_PREPARE - messages
COM_INIT_DB - Auth plugins other than or
caching_sha2_passwordmysql_native_password
Workaround: For unsupported features, create a second direct client connection (without Hyperdrive).
- 查询中的非UTF8字符
- 语句
USE - 多语句查询
- 协议层面的预编译语句()
COM_STMT_PREPARE - 消息
COM_INIT_DB - 或
caching_sha2_password之外的认证插件mysql_native_password
Workaround:对于不支持的特性,创建第二个不通过Hyperdrive的直接客户端连接。
Performance Best Practices
性能最佳实践
- Avoid long-running transactions - Limits connection multiplexing
- Use prepared statements - Enables query caching (postgres.js: )
prepare: true - Set max: 5 for pools - Stays within Workers' 6 connection limit
- Disable fetch_types if not needed - Reduces latency (postgres.js)
- Use ctx.waitUntil() for cleanup - Non-blocking connection close
- Cache-friendly queries - Prefer SELECT over complex joins
- Index frequently queried columns - Improves query performance
- Monitor with Hyperdrive analytics - Track cache hit ratios and latency
- ⚠️ SET statement persistence - SET commands don't persist across queries due to transaction mode. Wrap SET + query in BEGIN/COMMIT if needed (impacts performance)
- 避免长时间运行的事务 - 会限制连接多路复用
- 使用预编译语句 - 启用查询缓存(postgres.js需设置)
prepare: true - 连接池max值设置为5 - 不超过Workers的6个连接限制
- 不需要时禁用fetch_types - 减少延迟(postgres.js)
- 使用ctx.waitUntil()进行清理 - 非阻塞式关闭连接
- 使用缓存友好的查询 - 优先使用SELECT而非复杂连接
- 为频繁查询的列创建索引 - 提升查询性能
- 使用Hyperdrive分析工具监控 - 跟踪缓存命中率与延迟
- ⚠️ SET语句持久化 - 由于事务模式,SET命令无法在查询间持久化。若需要,将SET+查询包裹在BEGIN/COMMIT中(会影响性能)
Troubleshooting
故障排查
See for complete error reference with solutions.
references/troubleshooting.mdQuick fixes:
| Error | Solution |
|---|---|
| "No such module 'node:*'" | Add |
| "TLS not supported by database" | Enable SSL/TLS on your database |
| "Connection refused" | Check firewall rules, allow public internet or use Tunnel |
| "Failed to acquire connection" | Use |
| "Code generation from strings disallowed" | Set |
| "Bad hostname" | Verify DNS resolves, check for typos |
| "Invalid database credentials" | Check username/password (case-sensitive) |
完整的错误参考与解决方案请查看。
references/troubleshooting.md快速修复:
| 错误 | 解决方案 |
|---|---|
| "No such module 'node:*'" | 在compatibility_flags中添加 |
| "TLS not supported by database" | 为数据库启用SSL/TLS |
| "Connection refused" | 检查防火墙规则,允许公网访问或使用Cloudflare Tunnel |
| "Failed to acquire connection" | 使用 |
| "Code generation from strings disallowed" | 在mysql2配置中设置 |
| "Bad hostname" | 验证DNS解析,检查拼写错误 |
| "Invalid database credentials" | 检查用户名/密码(区分大小写) |
Metrics and Analytics
指标与分析
Hyperdrive Dashboard → Select config → Metrics tab
Available: Query count, cache hit ratio, query latency (p50/p95/p99), connection latency, query/result bytes, error rate
Credential Rotation
凭证轮换
bash
undefinedbash
undefinedOption 1: Create new config (zero downtime)
选项1:创建新配置(零停机)
wrangler hyperdrive create my-db-v2 --connection-string="postgres://new-creds..."
wrangler hyperdrive create my-db-v2 --connection-string="postgres://new-creds..."
Update wrangler.jsonc, deploy, delete old config
更新wrangler.jsonc,部署,删除旧配置
Option 2: Update existing
选项2:更新现有配置
wrangler hyperdrive update <id> --connection-string="postgres://new-creds..."
**Best practice**: Separate configs for staging/production.
---wrangler hyperdrive update <id> --connection-string="postgres://new-creds..."
**最佳实践**:为 staging 与 production 环境使用独立的配置。
---References
参考资料
- Official Documentation
- Get Started Guide
- How Hyperdrive Works
- Query Caching
- Local Development
- TLS/SSL Certificates
- Troubleshooting Guide
- Wrangler Commands
- Supported Databases
Last verified: 2026-01-21 | Skill version: 3.0.0 | Changes: Added 11 Known Issues Prevention entries (6 TIER 1, 5 TIER 2), expanded Prisma/Local Dev/Performance sections with critical warnings, updated Never Do rules
Package Versions: wrangler@4.58.0, pg@8.16.3+ (minimum), postgres@3.4.5+ (minimum for caching), postgres@3.4.8 (recommended), mysql2@3.16.0
Production Tested: Based on official Cloudflare documentation and community examples
最后验证:2026-01-21 | 指南版本:3.0.0 | 变更:新增11种已知问题预防条目(6个一级问题,5个二级问题),扩展Prisma/本地开发/性能章节的关键警告,更新禁止规则
软件包版本:wrangler@4.58.0,pg@8.16.3+(最低要求),postgres@3.4.5+(缓存功能最低要求),postgres@3.4.8(推荐),mysql2@3.16.0
生产环境验证:基于Cloudflare官方文档与社区示例