Skip to content

Commit 8d1b276

Browse files
committed
docs: 添加 Cloudflare Pages 部署常见问题说明
说明 Compatibility date 需要设置为 2024-09-23 或更晚才能使 nodejs_compat 正常生效
1 parent 41025d5 commit 8d1b276

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@
322322

323323
- [claw 部署](https://console.run.claw.cloud/signin?link=4TLWOT0ZFPO3):docker 容器化部署,操作快捷
324324

325+
## 常见问题(Q&A)
326+
327+
### Cloudflare Pages 部署后对话请求 500 错误 / 配置无法正确解析
328+
329+
**原因**:Cloudflare Pages 的 Compatibility date 设置过旧。
330+
331+
**解决**:将 Compatibility date 设置为 `2024-09-23` 或更晚。详见 [Cloudflare Pages 部署指南](./docs/cloudflare-pages-cn.md#常见问题qa)
332+
325333

326334
## 计划功能
327335

docs/cloudflare-pages-cn.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,23 @@
4040
15. 在 "Configure Production compatibility flag" 和 "Configure Preview compatibility flag" 中填写 "nodejs_compat"。
4141
16. 前往 "Deployments",点击 "Retry deployment"。
4242
17. Enjoy.
43+
44+
---
45+
46+
## 常见问题(Q&A)
47+
48+
### Q: 部署成功但对话请求返回 500 错误 / 侧边栏标题、模型列表等显示异常
49+
50+
**原因**:Cloudflare Pages 的 Compatibility date 设置过旧,导致 `nodejs_compat` 的内置 Node.js API/Polyfills 无法正常生效。
51+
52+
根据 [Cloudflare 官方文档](https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag),要使 `nodejs_compat` 完全生效,**Compatibility date 必须设置为 `2024-09-23` 或更晚的日期**
53+
54+
**解决方法**
55+
56+
1. 进入 Cloudflare Dashboard → Pages → 你的项目
57+
2. 进入 **Settings****Functions**
58+
3. 找到 **Compatibility date** 设置项
59+
4. 将日期修改为 `2024-09-23` 或更晚(建议直接填写当天日期)
60+
5. 保存后重新部署项目
61+
62+
> 注意:Production 和 Preview 环境的 Compatibility date 需要分别设置。

0 commit comments

Comments
 (0)