Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route Segment Config 遗漏 #982

Closed
wants to merge 1 commit into from
Closed

Conversation

nenryo
Copy link

@nenryo nenryo commented Apr 21, 2023

尝试 cloudflare page 部署时, 根据 build-output-api, 发现 #239 问题是缺少 runtime config。

vercel build, 检查 ./.vercel/output/functions/**/.vc-config.json, 部分是 "runtime": "nodejs18.x"

根据 segment-config

The Route Segment Config Options allows you configure the behavior of a Page, Layout or Route Handler

添加 runtime 后可以正常在 cloudflare pages 部署, 但目前访问存在问题;

log 里会提示 "message": "Dynamic require of \"node:buffer\" is not supported" , 应该是这个 next-on-pages 上这个 PR 没有完全解决问题

@Yidadaa
Copy link
Collaborator

Yidadaa commented Apr 21, 2023

cf 尚不支持 nextjs 13 app dir 特性

@nenryo
Copy link
Author

nenryo commented Apr 21, 2023

cf 尚不支持 nextjs 13 app dir 特性

https://github.com/cloudflare/next-on-pages/blob/main/docs/examples.md#nextjs-13s-app-directory

看样例是支持的, 但目前访问确实存在问题

@darth-pika-hu
Copy link
Contributor

darth-pika-hu commented May 9, 2023

大家好像对Cloudflare 不是很熟悉。我写了一个说明,提交了一个Merge request,请看:#1368

cf 尚不支持 nextjs 13 app dir 特性

支持,需要设置NODE_VERSION=18,可以得到warn(看到这个warn才表示支持且已经加载)如下:

warn  - You have enabled experimental feature (appDir) in next.config.mjs.
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

@SmolderingGiraffe 你把问题想复杂了。

Cloudflare Pages对Next.js的支持是比较完善的,对Next.js的build会直接用Vercel的API,具体看这里这里

几个要点:

  • Cloudflare Pages要在Environment variables里,设置NODE_VERSION=18 (19,20.1都行,随便,默认是12.18肯定不行的),具体的支持情况看这里
  • Cloudflare Pages 有25Mb的限制
  • Dashboard里Build的时候一定要选Next.js,会自动调用Vercel API,默认值不要改动。CLI手动build命令为:npx @cloudflare/next-on-pages --experimental-minify。
  • 本地开发用wrangler dev --experimental-local,具体看这里
  • 要有compatibility_flags,compatibility_flags一定要加上nodejs_compat,结合上一条,本地开发要用如下命令:wrangler pages dev [] --compatibility-flags="nodejs_compat" --experimental-local。不然Pages build到最后会报错,如下 (另外,Next-on-Pages这个地方有个bug,目前Prerelease里有一个workaround):
| Found _worker.js in output directory. Uploading.
-- | --
| ✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.
| ✘ [ERROR] Could not resolve "node:buffer"
|  
| _worker.js:2:2886:
| 2 │ ...ar fe={};import*as Wn from"node:buffer";var Br=D(()=>{P();w();_e...
| ╵                              ~~~~~~~~~~~~~
|  
| The package "node:buffer" wasn't found on the file system but is built into node.
| Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.

我的 Environment variables 供参考:
GO_VERSION=1.20.3
HUGO_VERSION=0.111.3
NODE_VERSION=20.1
PYTHON_VERSION=3.7
YARN_VERSION=1.22.19
NEXT_TELEMETRY_DISABLE=1
PHP_VERSION=7.4
OPENAI_API_KEY=(可选,填你的API,但是记得build完了去encrypt,然后加个Cloudflare Access只分享给你信得过的人)

@Yidadaa
Copy link
Collaborator

Yidadaa commented May 10, 2023

挺麻烦的,感觉还是 vercel 比较方便,不过总归有人需要这个。

@Yidadaa Yidadaa closed this May 10, 2023
@darth-pika-hu
Copy link
Contributor

挺麻烦的,感觉还是 vercel 比较方便,不过总归有人需要这个。

和Vercel比较是挺麻烦的

@ccinoo
Copy link

ccinoo commented May 10, 2023

确实复杂,我部署了几次,部署日志中没有报错。但聊天时就是提示**“出错了,稍后重试吧”**。各位大佬,能否指点下?

`

20:25:43.814 Cloning repository...
20:25:44.691 From https://github.com/***/ChatGPT-Web-Fork
20:25:44.692 * branch d03ad9f -> FETCH_HEAD
20:25:44.692  
20:25:44.781 HEAD is now at d03ad9f Merge branch 'main' of https://github.com/Yidadaa/ChatGPT-Next-Web
20:25:44.781  
20:25:44.892  
20:25:44.925 Success: Finished cloning repository files
20:25:45.510 Installing dependencies
20:25:45.517 Python version set to 3.7
20:25:48.846 Downloading and installing node v20.1.0...
20:25:49.123 Downloading https://nodejs.org/dist/v20.1.0/node-v20.1.0-linux-x64.tar.xz...
20:25:49.476 Computing checksum with sha256sum
20:25:49.618 Checksums matched!
20:25:55.002 Now using node v20.1.0 (npm v9.6.4)
20:25:55.308 Started restoring cached build plugins
20:25:55.317 Finished restoring cached build plugins
20:25:55.701 Attempting ruby version 2.7.1, read from environment
20:25:57.184 Using /opt/buildhome/.rvm/gems/ruby-2.7.1
20:25:58.161 Using PHP version 7.4
20:25:58.250 5.2.5 is already installed.
20:25:58.266 Using Swift version 5.2.5
20:25:58.266 Started restoring cached node modules
20:25:58.278 Finished restoring cached node modules
20:25:58.286 Started restoring cached yarn cache
20:25:58.296 Finished restoring cached yarn cache
20:25:58.322 Installing yarn at version 1.22.19
20:25:58.339 Installing Yarn!
20:25:58.339 > Downloading tarball...
20:25:58.369  
20:25:58.370 [1/2]: https://yarnpkg.com/downloads/1.22.19/yarn-v1.22.19.tar.gz --> /tmp/yarn.tar.gz.BhJDVhDHBq
20:25:58.370 % Total % Received % Xferd Average Speed Time Time Time Current
20:25:58.371 Dload Upload Total Spent Left Speed
20:25:58.425 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 82 100 82 0 0 1518 0 --:--:-- --:--:-- --:--:-- 1518
20:25:58.469 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 94 100 94 0 0 949 0 --:--:-- --:--:-- --:--:-- 15666
20:25:58.650 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
20:25:58.839 100 1215k 100 1215k 0 0 2596k 0 --:--:-- --:--:-- --:--:-- 2596k
20:25:58.839  
20:25:58.839 [2/2]: https://yarnpkg.com/downloads/1.22.19/yarn-v1.22.19.tar.gz.asc --> /tmp/yarn.tar.gz.BhJDVhDHBq.asc
20:25:58.840 % Total % Received % Xferd Average Speed Time Time Time Current
20:25:58.840 Dload Upload Total Spent Left Speed
20:25:58.872 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 86 100 86 0 0 2687 0 --:--:-- --:--:-- --:--:-- 2687
20:25:58.876 100 98 100 98 0 0 2722 0 --:--:-- --:--:-- --:--:-- 2722
20:25:43.814 Cloning repository...
20:25:44.691 From https://github.com/***/ChatGPT-Web-Fork
20:25:44.692 * branch d03ad9f -> FETCH_HEAD
20:25:44.692  
20:25:44.781 HEAD is now at d03ad9f Merge branch 'main' of https://github.com/Yidadaa/ChatGPT-Next-Web
20:25:44.781  
20:25:44.892  
20:25:44.925 Success: Finished cloning repository files
20:25:45.510 Installing dependencies
20:25:45.517 Python version set to 3.7
20:25:48.846 Downloading and installing node v20.1.0...
20:25:49.123 Downloading https://nodejs.org/dist/v20.1.0/node-v20.1.0-linux-x64.tar.xz...
20:25:49.476 Computing checksum with sha256sum
20:25:49.618 Checksums matched!
20:25:55.002 Now using node v20.1.0 (npm v9.6.4)
20:25:55.308 Started restoring cached build plugins
20:25:55.317 Finished restoring cached build plugins
20:25:55.701 Attempting ruby version 2.7.1, read from environment
20:25:57.184 Using /opt/buildhome/.rvm/gems/ruby-2.7.1
20:25:58.161 Using PHP version 7.4
20:25:58.250 5.2.5 is already installed.
20:25:58.266 Using Swift version 5.2.5
20:25:58.266 Started restoring cached node modules
20:25:58.278 Finished restoring cached node modules
20:25:58.286 Started restoring cached yarn cache
20:25:58.296 Finished restoring cached yarn cache
20:25:58.322 Installing yarn at version 1.22.19
20:25:58.339 Installing Yarn!
20:25:58.339 > Downloading tarball...
20:25:58.369  
20:25:58.370 [1/2]: https://yarnpkg.com/downloads/1.22.19/yarn-v1.22.19.tar.gz --> /tmp/yarn.tar.gz.BhJDVhDHBq
20:25:58.370 % Total % Received % Xferd Average Speed Time Time Time Current
20:25:58.371 Dload Upload Total Spent Left Speed
20:25:58.425 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 82 100 82 0 0 1518 0 --:--:-- --:--:-- --:--:-- 1518
20:25:58.469 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 94 100 94 0 0 949 0 --:--:-- --:--:-- --:--:-- 15666
20:25:58.650 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
20:25:58.839 100 1215k 100 1215k 0 0 2596k 0 --:--:-- --:--:-- --:--:-- 2596k
20:25:58.839  
20:25:58.839 [2/2]: https://yarnpkg.com/downloads/1.22.19/yarn-v1.22.19.tar.gz.asc --> /tmp/yarn.tar.gz.BhJDVhDHBq.asc
20:25:58.840 % Total % Received % Xferd Average Speed Time Time Time Current
20:25:58.840 Dload Upload Total Spent Left Speed
20:25:58.872 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 86 100 86 0 0 2687 0 --:--:-- --:--:-- --:--:-- 2687
20:25:58.876 100 98 100 98 0 0 2722 0 --:--:-- --:--:-- --:--:-- 2722
20:25:59.032 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
20:25:59.115 100 833 100 833 0 0 3029 0 --:--:-- --:--:-- --:--:-- 3029
20:25:59.126 > Verifying integrity...
20:25:59.155 gpg: Oops: lock already held by us
20:25:59.165 gpg: Signature made Tue 10 May 2022 07:48:23 PM UTC
20:25:59.165 gpg: using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
20:25:59.168 gpg: Good signature from "Yarn Packaging [email protected]" [unknown]
20:25:59.170 gpg: WARNING: This key is not certified with a trusted signature!
20:25:59.170 gpg: There is no indication that the signature belongs to the owner.
20:25:59.170 Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
20:25:59.171 Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
20:25:59.172 > GPG signature looks good
20:25:59.172 > Extracting to ~/.yarn...
20:25:59.246 > Adding to $PATH...
20:25:59.262 > We've added the following to your /opt/buildhome/.bashrc
20:25:59.262 > If this isn't the profile of your current shell then please add the following to your correct profile:
20:25:59.262  
20:25:59.262 export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
20:25:59.263  
20:25:59.637 > Successfully installed Yarn 1.22.19! Please open another terminal where the yarn command will now be available.
20:26:00.011 Installing NPM modules using Yarn version 1.22.19
20:26:01.353 yarn install v1.22.19
20:26:01.375 warning package.json: License should be a valid SPDX license expression
20:26:01.434 warning [email protected]: License should be a valid SPDX license expression
20:26:01.436 [1/4] Resolving packages...
20:26:01.661 [2/4] Fetching packages...
20:26:31.939 [3/4] Linking dependencies...
20:26:31.945 warning "mermaid > @khanacademy/[email protected]" has incorrect peer dependency "[email protected]".
20:26:31.946 warning "mermaid > @khanacademy/[email protected]" has incorrect peer dependency "[email protected]".
20:26:48.409 [4/4] Building fresh packages...
20:26:48.437 $ husky install
20:26:48.572 husky - Git hooks installed
20:26:48.581 Done in 47.23s.
20:26:48.627 NPM modules installed using Yarn
20:26:48.908 warning package.json: License should be a valid SPDX license expression
20:26:48.938 Installing Hugo 0.111.3
20:26:49.961 hugo v0.111.3-5d4eb5154e1fed125ca8e9b5a0315c4180dab192+extended linux/amd64 BuildDate=2023-03-12T11:40:50Z VendorInfo=gohugoio
20:26:49.966 Started restoring cached go cache
20:26:49.981 Finished restoring cached go cache
20:26:49.982 Installing Go version 1.20.3
20:26:55.673  
20:26:55.693 unset GOOS;
20:26:55.702 unset GOARCH;
20:26:55.702 export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.20.3.linux.amd64';
20:26:55.702 export PATH="/opt/buildhome/.gimme_cache/versions/go1.20.3.linux.amd64/bin:${PATH}";
20:26:55.702 go version >&2;
20:26:55.702  
20:26:55.705 export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.20.3.linux.amd64.env"
20:26:55.715 go version go1.20.3 linux/amd64
20:26:55.718 Installing missing commands
20:26:55.718 Verify run directory
20:26:55.719 Executing user command: npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify
20:26:57.529 npm WARN exec The following package was not found and will be installed: https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230
20:27:10.716 npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
20:27:10.855 npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
20:27:11.717 npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
20:27:23.337 ⚡️ @cloudflare/next-on-pages CLI v.0.0.0-ed1dbf1 (prerelease for PR #230)
20:27:23.337  
20:27:23.338 ⚡️ Warning: the --experimental-minify|-e flag is deprecated and doesn't produce any effect, the
20:27:23.338 ⚡️ (previously named) experimental minification is now enabled by default, you can disable it
20:27:23.338 ⚡️ via the --disable-chunks-dedup|-d flag.
20:27:23.338 ⚡️
20:27:23.339 ⚡️ Note: if you're using the --experimental-minify|-e flag in your build command please remove it
20:27:23.339 ⚡️ as it will be removed in a future version of the package (causing your command to fail).
20:27:23.339  
20:27:23.568 ⚡️ Detected Package Manager: yarn (classic)
20:27:23.568 ⚡️ Preparing project...
20:27:23.571 ⚡️ Project is ready
20:27:23.571 ⚡️ Installing vercel as dev dependencies with 'yarn add vercel -D'...
20:27:23.815 ▲ yarn add v1.22.19
20:27:23.836 ▲ warning package.json: License should be a valid SPDX license expression
20:27:23.904 ▲ warning [email protected]: License should be a valid SPDX license expression
20:27:23.909 ▲ [1/4] Resolving packages...
20:27:25.288 ▲ warning vercel > @vercel/remix-builder > @remix-run/dev > cacache > @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
20:27:26.615 ▲ [2/4] Fetching packages...
20:28:10.162 ▲ [3/4] Linking dependencies...
20:28:10.170 ▲ warning "mermaid > @khanacademy/[email protected]" has incorrect peer dependency "[email protected]".
20:28:10.170 ▲ warning "mermaid > @khanacademy/[email protected]" has incorrect peer dependency "[email protected]".
20:28:36.933 ▲ [4/4] Building fresh packages...
20:28:40.194 ▲ success Saved lockfile.
20:28:40.200 ▲ warning [email protected]: License should be a valid SPDX license expression
20:28:40.296 ▲ success Saved 272 new dependencies.
20:28:40.296 ▲ info Direct dependencies
20:28:40.300 ▲ └─ [email protected]
20:28:40.301 ▲ info All dependencies
20:28:40.304 ▲ ├─ @cspotcode/[email protected]
20:28:40.304 ▲ ├─ @edge-runtime/[email protected]
20:28:40.304 ▲ ├─ @edge-runtime/[email protected]
20:28:40.304 ▲ ├─ @edge-runtime/[email protected]
20:28:40.304 ▲ ├─ @emotion/[email protected]
20:28:40.304 ▲ ├─ @esbuild/[email protected]
20:28:40.304 ▲ ├─ @gar/[email protected]
20:28:40.304 ▲ ├─ @jspm/[email protected]
20:28:40.304 ▲ ├─ @mapbox/[email protected]
20:28:40.304 ▲ ├─ @npmcli/[email protected]
20:28:40.304 ▲ ├─ @npmcli/[email protected]
20:28:40.304 ▲ ├─ @npmcli/[email protected]
20:28:40.304 ▲ ├─ @remix-run/[email protected]
20:28:40.304 ▲ ├─ @remix-run/[email protected]
20:28:40.304 ▲ ├─ @sinclair/[email protected]
20:28:40.304 ▲ ├─ @sindresorhus/[email protected]
20:28:40.304 ▲ ├─ @szmarczak/[email protected]
20:28:40.304 ▲ ├─ @ts-morph/[email protected]
20:28:40.304 ▲ ├─ @tsconfig/[email protected]
20:28:40.304 ▲ ├─ @tsconfig/[email protected]
20:28:40.304 ▲ ├─ @tsconfig/[email protected]
20:28:40.304 ▲ ├─ @tsconfig/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @types/[email protected]
20:28:40.304 ▲ ├─ @vanilla-extract/[email protected]
20:28:40.305 ▲ ├─ @vanilla-extract/[email protected]
20:28:40.305 ▲ ├─ @vanilla-extract/[email protected]
20:28:40.305 ▲ ├─ @vanilla-extract/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.305 ▲ ├─ @vercel/[email protected]
20:28:40.306 ▲ ├─ @vercel/[email protected]
20:28:40.306 ▲ ├─ @vercel/[email protected]
20:28:40.306 ▲ ├─ @web3-storage/[email protected]
20:28:40.306 ▲ ├─ [email protected]
20:28:40.306 ▲ ├─ [email protected]
20:28:40.306 ▲ ├─ [email protected]
20:28:40.306 ▲ ├─ [email protected]
20:28:40.306 ▲ ├─ [email protected]
20:28:40.306 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.307 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.308 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.309 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.310 ▲ ├─ [email protected]
20:28:40.311 ▲ ├─ [email protected]
20:28:40.311 ▲ ├─ [email protected]
20:28:40.311 ▲ ├─ [email protected]
20:28:40.311 ▲ ├─ [email protected]
20:28:40.311 ▲ ├─ [email protected]
20:28:40.311 ▲ ├─ [email protected]
20:28:40.312 ▲ ├─ [email protected]
20:28:40.312 ▲ ├─ [email protected]
20:28:40.312 ▲ ├─ [email protected]
20:28:40.312 ▲ ├─ [email protected]
20:28:40.312 ▲ ├─ [email protected]
20:28:40.312 ▲ ├─ [email protected]
20:28:40.312 ▲ ├─ [email protected]
20:28:40.313 ▲ ├─ [email protected]
20:28:40.313 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.315 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.316 ▲ ├─ [email protected]
20:28:40.317 ▲ ├─ [email protected]
20:28:40.317 ▲ ├─ [email protected]
20:28:40.317 ▲ ├─ [email protected]
20:28:40.317 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.318 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.319 ▲ ├─ [email protected]
20:28:40.320 ▲ ├─ [email protected]
20:28:40.320 ▲ ├─ [email protected]
20:28:40.320 ▲ ├─ [email protected]
20:28:40.320 ▲ ├─ [email protected]
20:28:40.320 ▲ ├─ [email protected]
20:28:40.320 ▲ ├─ [email protected]
20:28:40.320 ▲ ├─ [email protected]
20:28:40.321 ▲ ├─ [email protected]
20:28:40.321 ▲ ├─ [email protected]
20:28:40.321 ▲ ├─ [email protected]
20:28:40.322 ▲ ├─ [email protected]
20:28:40.322 ▲ ├─ [email protected]
20:28:40.322 ▲ ├─ [email protected]
20:28:40.322 ▲ ├─ [email protected]
20:28:40.322 ▲ ├─ [email protected]
20:28:40.322 ▲ ├─ [email protected]
20:28:40.323 ▲ ├─ [email protected]
20:28:40.323 ▲ ├─ [email protected]
20:28:40.323 ▲ ├─ [email protected]
20:28:40.324 ▲ ├─ [email protected]
20:28:40.324 ▲ ├─ [email protected]
20:28:40.324 ▲ ├─ [email protected]
20:28:40.324 ▲ ├─ [email protected]
20:28:40.324 ▲ ├─ [email protected]
20:28:40.325 ▲ ├─ [email protected]
20:28:40.325 ▲ ├─ [email protected]
20:28:40.325 ▲ ├─ [email protected]
20:28:40.325 ▲ ├─ [email protected]
20:28:40.325 ▲ ├─ [email protected]
20:28:40.325 ▲ ├─ [email protected]
20:28:40.325 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.326 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.327 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.328 ▲ ├─ [email protected]
20:28:40.329 ▲ ├─ [email protected]
20:28:40.329 ▲ ├─ [email protected]
20:28:40.329 ▲ ├─ [email protected]
20:28:40.329 ▲ ├─ [email protected]
20:28:40.329 ▲ ├─ [email protected]
20:28:40.330 ▲ ├─ [email protected]
20:28:40.330 ▲ ├─ [email protected]
20:28:40.330 ▲ ├─ [email protected]
20:28:40.330 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.334 ▲ ├─ [email protected]
20:28:40.335 ▲ ├─ [email protected]
20:28:40.335 ▲ ├─ [email protected]
20:28:40.335 ▲ ├─ [email protected]
20:28:40.335 ▲ ├─ [email protected]
20:28:40.335 ▲ ├─ [email protected]
20:28:40.335 ▲ ├─ [email protected]
20:28:40.336 ▲ ├─ [email protected]
20:28:40.336 ▲ ├─ [email protected]
20:28:40.336 ▲ ├─ [email protected]
20:28:40.338 ▲ ├─ [email protected]
20:28:40.338 ▲ ├─ [email protected]
20:28:40.338 ▲ ├─ [email protected]
20:28:40.338 ▲ ├─ [email protected]
20:28:40.338 ▲ └─ [email protected]
20:28:40.338 ▲ $ husky install
20:28:40.433 ▲ husky - Git hooks installed
20:28:40.442 ▲ Done in 76.63s.
20:28:40.523 ⚡️ Install completed
20:28:40.524 ⚡️ Building project...
20:28:40.793 ▲ yarn run v1.22.19
20:28:40.814 ▲ warning package.json: License should be a valid SPDX license expression
20:28:40.833 ▲ $ /opt/buildhome/repo/node_modules/.bin/vercel build
20:28:41.392 ▲ Vercel CLI 29.1.1
20:28:41.698 ▲ Installing dependencies...
20:28:41.950 ▲ warning package.json: License should be a valid SPDX license expression
20:28:42.015 ▲ warning [email protected]: License should be a valid SPDX license expression
20:28:42.021 ▲ [1/4] Resolving packages...
20:28:42.363 ▲ success Already up-to-date.
20:28:42.373 ▲ $ husky install
20:28:42.490 ▲ husky - Git hooks installed
20:28:42.528 ▲ Detected Next.js version: 13.3.1-canary.8
20:28:42.531 ▲ Running "yarn run build"
20:28:42.774 ▲ warning package.json: License should be a valid SPDX license expression
20:28:42.794 ▲ $ yarn fetch && next build
20:28:43.055 ▲ warning package.json: License should be a valid SPDX license expression
20:28:43.074 ▲ $ node ./scripts/fetch-prompts.mjs
20:28:43.234 ▲ [Fetch] fetching cn prompts...
20:28:43.275 ▲ [Fetch] fetching en prompts...
20:28:44.170 ▲ [Fetch] saved to ./public/prompts.json
20:28:48.844 ▲ warn - You have enabled experimental feature (appDir) in next.config.mjs.
20:28:48.845 ▲ warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
20:28:48.845 ▲ info - Thank you for testing appDir please leave your feedback at https://nextjs.link/app-feedback
20:28:48.845
20:28:48.879 ▲ Attention: Next.js now collects completely anonymous telemetry regarding usage.
20:28:48.880 ▲ This information is used to shape Next.js' roadmap and prioritize features.
20:28:48.880 ▲ You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
20:28:48.880 https://nextjs.org/telemetry
20:28:49.042 ▲ info - Creating an optimized production build...
20:29:33.807 ▲ info - Compiled successfully
20:29:33.811 ▲ info - Linting and checking validity of types...
20:29:36.335 ▲ Pages directory cannot be found at /opt/buildhome/repo/pages or /opt/buildhome/repo/src/pages. If using a custom path, please configure with the no-html-link-for-pages rule in your eslint config file.
20:29:39.133 ▲ info - Collecting page data...
20:29:58.368 ▲ info - Generating static pages (0/3)
20:29:58.588 ▲ [Lang] failed to detect user lang.
20:29:58.667 ▲ [Lang] failed to detect user lang.
20:29:58.690 ▲ info - Generating static pages (3/3)
20:29:58.707 ▲ info - Finalizing page optimization...
20:29:58.713
20:29:58.751 ▲ Route (app) Size First Load JS
20:29:58.751 ▲ ┌ ○ / 50.8 kB 127 kB
20:29:58.751 ▲ ├ ℇ /api/config 0 B 0 B
20:29:58.751 ▲ └ ℇ /api/openai/[...path] 0 B 0 B
20:29:58.751 ▲ + First Load JS shared by all 75.8 kB
20:29:58.751 ▲ ├ chunks/2443530c-7e994f9f7e04c603.js 50.5 kB
20:29:58.752 ▲ ├ chunks/4961-0f8489e607d0e844.js 22.2 kB
20:29:58.752 ▲ ├ chunks/main-app-bdb90b32c7a97dc2.js 219 B
20:29:58.752 ▲ └ chunks/webpack-0a6575b20858cc6d.js 2.94 kB
20:29:58.752
20:29:58.752 ▲ Route (pages) Size First Load JS
20:29:58.752 ▲ ─ ○ /404 181 B 91.6 kB
20:29:58.752 ▲ + First Load JS shared by all 91.4 kB
20:29:58.752 ▲ ├ chunks/main-9a72734a2cf2146b.js 88.2 kB
20:29:58.752 ▲ ├ chunks/pages/_app-749d53c4cd4de805.js 193 B
20:29:58.752 ▲ └ chunks/webpack-0a6575b20858cc6d.js 2.94 kB
20:29:58.753 ▲ ℇ (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components)
20:29:58.753 ▲ ○ (Static) automatically rendered as static HTML (uses no initial props)
20:30:04.421 ▲ Traced Next.js server files in: 4.889s
20:30:16.000 ▲ Created all serverless functions in: 11.578s
20:30:16.121 ▲ Collected static files (public/, static/, .next/static): 28.476ms
20:30:17.572 ▲ Build Completed in .vercel/output [2m]
20:30:17.670 ▲ Done in 96.88s.
20:30:17.940 ⚡️ Completed yarn vercel build.
20:30:18.437 ⚡️ Generated '.vercel/output/static/_worker.js/index.js'.
20:30:18.487 Finished
20:30:18.488 Note: No functions dir at /functions found. Skipping.
20:30:18.488 Validating asset output directory
20:30:19.296 Deploying your site to Cloudflare's global network...
20:30:20.030 Parsed 1 valid header rule.
20:30:21.180 Uploading... (127/135)
20:30:21.735 Uploading... (130/135)
20:30:21.856 Uploading... (132/135)
20:30:21.894 Uploading... (135/135)
20:30:21.895 ✨ Success! Uploaded 8 files (127 already uploaded) (1.14 sec)
20:30:21.895  
20:30:22.204 ✨ Upload complete!
20:30:24.020 Success: Assets published!
20:30:24.952 Success: Your site was deployed!

`

@doherty88
Copy link

我提醒一下,按照 @darth-pika-hu 提到的环境变量设置就可以build成功,另外要注意几点

  1. 就像 @darth-pika-hu 说的那样,要设置一下兼容性标志,具体在workers and pages -> 点击pages程序名字->设置->函数->兼容性标志 ,加上nodejs_compat
  2. 另外就是build好的应用在提问的时候会出现这个错 : Error: The 'cache' field on 'RequestInitializerDict' is not implemented. 需要修改一下 /app/api/common.ts 第42行左右,去掉 cache: "no-store",

@darth-pika-hu
Copy link
Contributor

darth-pika-hu commented Jun 4, 2023

@doherty88 正解,但是命令现在用默认的就可以。Cache的问题作者貌似没兴趣修改,Cloudflare说会在worker 中修正,但是没有时间线。2.6之前要想在pages运行,要改的地方更多,不然连API key 都识别不了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants