NextChat
NextChat copied to clipboard
[Bug] 按照FAQ中 cloudfare pages的部署步骤,无法部署
Describe the bug A clear and concise description of what the bug is.
按照FAQ中 cloudfare pages的部署步骤, 无法完成部署。
⚡ Completed yarn vercel build
.
⚡ ERROR: Failed to produce a Cloudflare Pages build from the project. ⚡ ⚡ The following routes were not configured to run with the Edge Runtime: ⚡ - /api/cors/[...path] ⚡ ⚡ Please make sure that all your non-static routes export the following edge runtime route segment config: ⚡ export const runtime = 'edge'; ⚡ ⚡ You can read more about the Edge Runtime on the Next.js documentation: ⚡ https://nextjs.org/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes
▲ Done in 40.40s.
To Reproduce Steps to reproduce the behavior: 按照FAQ中 cloudfare pages的方法进行部署
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Deployment
- [ ] Docker
- [ ] Vercel
- [ ] Server
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional Logs Add any logs about the problem here.
Bot detected the issue body's language is not English, translate it automatically.
Title: [Bug] According to the deployment steps of cloudfare pages in FAQ, it cannot be deployed.
https://github.com/Yidadaa/ChatGPT-Next-Web/commit/59fbadd9ebdd494b612340cb4051b83518832207
好像是这个改动引起的。
Bot detected the issue body's language is not English, translate it automatically.
https://github.com/Yidadaa/ChatGPT-Next-Web/commit/59fbadd9ebdd494b612340cb4051b83518832207
It seems to be caused by this change.
在cloudflare部署前需要修改下面三个文件的runtime才能完成部署
-
/app/api/config/route.ts
-
/app/cors/[...path]/route.ts
-
/app/openai/[...path]/route.ts
将这三个文件内容的export const runtime值修改成edge
-
例如:export const runtime = "edge";
在20231217代码拉取进行修改后已成功部署到cloudflare
Bot detected the issue body's language is not English, translate it automatically.
Before cloudflare deployment, you need to modify the runtime of the following three files to complete the deployment
-
/app/api/config/route.ts
-
/app/cors/[...path]/route.ts
-
/app/openai/[...path]/route.ts
Change the export const runtime value of the contents of these three files to edge
-
For example: export const runtime = "edge";
把构建命令改成这样就行了。
sed -i 's/nodejs/edge/g' app/api/cors/[...path]/route.ts && npx @cloudflare/[email protected]
Bot detected the issue body's language is not English, translate it automatically.
Just change the build command to this.
sed -i 's/nodejs/edge/g' app/api/cors/[...path]/route.ts && npx @cloudflare/[email protected]