From 4847e9ffef17a1f2266e6401c4b5cb672ca0c247 Mon Sep 17 00:00:00 2001 From: shinya Date: Sun, 13 Jul 2025 22:43:40 +0800 Subject: [PATCH] fix: getD1Database --- src/lib/d1.db.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/lib/d1.db.ts b/src/lib/d1.db.ts index 9f6bfdb..ca2ecf7 100644 --- a/src/lib/d1.db.ts +++ b/src/lib/d1.db.ts @@ -116,14 +116,7 @@ const INIT_SQL = ` // 获取全局D1数据库实例 function getD1Database(): D1Database { - // 在 next-on-pages 环境中,D1 数据库可能通过 process.env 暴露 - if (typeof process !== 'undefined' && (process.env as any).DB) { - return (process.env as any).DB as D1Database; - } - - throw new Error( - 'D1 database not available. Make sure DB is bound in your Cloudflare Pages project settings' - ); + return (process.env as any).DB as D1Database; } export class D1Storage implements IStorage {