[GH-ISSUE #47] 代码同步更新之后出现的问题 #36

Closed
opened 2026-02-27 09:12:59 +03:00 by kerem · 7 comments
Owner

Originally created by @eshop366 on GitHub (Jul 18, 2025).
Original GitHub issue: https://github.com/maillab/cloud-mail/issues/47

代码同步更新之后,为什么在打开邮箱主页时候出现下面错误:
Cannot read properties of undefined (reading 'get')

浏览器输入https://你的自定义域名/api/init/你绑定的的jwt_secret 会自动初始化数据库,这时候出现的错误是:
{
"code": 500,
"message": "Cannot read properties of undefined (reading 'prepare')"
}

Originally created by @eshop366 on GitHub (Jul 18, 2025). Original GitHub issue: https://github.com/maillab/cloud-mail/issues/47 代码同步更新之后,为什么在打开邮箱主页时候出现下面错误: Cannot read properties of undefined (reading 'get') 浏览器输入https://你的自定义域名/api/init/你绑定的的jwt_secret 会自动初始化数据库,这时候出现的错误是: { "code": 500, "message": "Cannot read properties of undefined (reading 'prepare')" }
kerem closed this issue 2026-02-27 09:12:59 +03:00
Author
Owner

@eshop366 commented on GitHub (Jul 18, 2025):

搞定了,需要重新添加绑定。回到worker设置界面绑定刚刚创建的数据库
d1数据库 变量名为 db
kv数据库 变量名为 kv

<!-- gh-comment-id:3090130366 --> @eshop366 commented on GitHub (Jul 18, 2025): 搞定了,需要重新添加绑定。回到worker设置界面绑定刚刚创建的数据库 d1数据库 变量名为 db kv数据库 变量名为 kv
Author
Owner

@eshop366 commented on GitHub (Jul 19, 2025):

但是依然无法初始化。错误还是如前所述。使用原admin也无法登录。

<!-- gh-comment-id:3091888109 --> @eshop366 commented on GitHub (Jul 19, 2025): 但是依然无法初始化。错误还是如前所述。使用原admin也无法登录。
Author
Owner

@Silentely commented on GitHub (Jul 19, 2025):

你是用什么方式部署的? 如果重新添加了变量或者修改了绑定需要重新部署再去初始化数据库

<!-- gh-comment-id:3092213049 --> @Silentely commented on GitHub (Jul 19, 2025): 你是用什么方式部署的? 如果重新添加了变量或者修改了绑定需要重新部署再去初始化数据库
Author
Owner

@eshop366 commented on GitHub (Jul 19, 2025):

你是用什么方式部署的? 如果重新添加了变量或者修改了绑定需要重新部署再去初始化数据库

我用cloudflare worker部署的

<!-- gh-comment-id:3092214370 --> @eshop366 commented on GitHub (Jul 19, 2025): > 你是用什么方式部署的? 如果重新添加了变量或者修改了绑定需要重新部署再去初始化数据库 我用cloudflare worker部署的
Author
Owner

@Silentely commented on GitHub (Jul 19, 2025):

你是用什么方式部署的? 如果重新添加了变量或者修改了绑定需要重新部署再去初始化数据库

我用cloudflare worker部署的

cloudflare worker上点进去你的项目重新部署最新版本,另外提供你的绑定页面截图,尽可能提供多些信息排查

<!-- gh-comment-id:3092216648 --> @Silentely commented on GitHub (Jul 19, 2025): > > 你是用什么方式部署的? 如果重新添加了变量或者修改了绑定需要重新部署再去初始化数据库 > > 我用cloudflare worker部署的 cloudflare worker上点进去你的项目重新部署最新版本,另外提供你的绑定页面截图,尽可能提供多些信息排查
Author
Owner

@eshop366 commented on GitHub (Jul 19, 2025):

在GitHub上拉取更新后,去CF的worker里面,设置>构建里面,断开连接,又重新建立连接,然后,确认了绑定没有问题之后,再重新部署,部署完成后,初始化时候就提示如下。
{
"code": 500,
"message": "c2.env.db.prepare is not a function"
}

<!-- gh-comment-id:3092224625 --> @eshop366 commented on GitHub (Jul 19, 2025): 在GitHub上拉取更新后,去CF的worker里面,设置>构建里面,断开连接,又重新建立连接,然后,确认了绑定没有问题之后,再重新部署,部署完成后,初始化时候就提示如下。 { "code": 500, "message": "c2.env.db.prepare is not a function" }
Author
Owner

@Silentely commented on GitHub (Jul 19, 2025):

在GitHub上拉取更新后,去CF的worker里面,设置>构建里面,断开连接,又重新建立连接,然后,确认了绑定没有问题之后,再重新部署,部署完成后,初始化时候就提示如下。 { "code": 500, "message": "c2.env.db.prepare is not a function" }

我这无法复现该问题,建议通过action部署或者删除项目按流程重新走一遍
11c93f584d3ce30d3dc35941e67b4dd2

<!-- gh-comment-id:3092229517 --> @Silentely commented on GitHub (Jul 19, 2025): > 在GitHub上拉取更新后,去CF的worker里面,设置>构建里面,断开连接,又重新建立连接,然后,确认了绑定没有问题之后,再重新部署,部署完成后,初始化时候就提示如下。 { "code": 500, "message": "c2.env.db.prepare is not a function" } 我这无法复现该问题,建议通过action部署或者删除项目按流程重新走一遍 ![11c93f584d3ce30d3dc35941e67b4dd2](https://i.mji.rip/2025/07/19/11c93f584d3ce30d3dc35941e67b4dd2.jpeg)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloud-mail-maillab#36
No description provided.