NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

[Bug] 按照FAQ中 cloudfare pages的部署步骤,无法部署

Open trulyliu opened this issue 1 year ago • 5 comments

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.

trulyliu avatar Nov 30 '23 06:11 trulyliu

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.

Issues-translate-bot avatar Nov 30 '23 06:11 Issues-translate-bot

https://github.com/Yidadaa/ChatGPT-Next-Web/commit/59fbadd9ebdd494b612340cb4051b83518832207

好像是这个改动引起的。

trulyliu avatar Nov 30 '23 06:11 trulyliu

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.

Issues-translate-bot avatar Nov 30 '23 06:11 Issues-translate-bot

在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 image image

ogvegzvt avatar Dec 16 '23 16:12 ogvegzvt

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";

Issues-translate-bot avatar Dec 16 '23 16:12 Issues-translate-bot

把构建命令改成这样就行了。

sed -i 's/nodejs/edge/g' app/api/cors/[...path]/route.ts && npx @cloudflare/[email protected]

aipeach avatar Jan 05 '24 07:01 aipeach

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]

Issues-translate-bot avatar Jan 05 '24 07:01 Issues-translate-bot