I followed this guide
https://developers.cloudflare.com/pages/framework-guides/deploy-a-nextjs-site/
to deploy a Next.js site on Cloudflare Page successfully. However, as soon as I introduced a D1 binding via cloudflare’s web console and redeploy the app without changing any code. It showed the following error.
11:14:10.096 Cloning repository...
11:14:11.629 warning: redirecting to https://gitlab.com/sandbox137/nextjs.git/
11:14:11.629 From https://gitlab.com/sandbox137/nextjs
11:14:11.629 * branch b67d791c2043f3971bc6a5cf481d4142f7ccd668 -> FETCH_HEAD
11:14:11.630
11:14:11.670 HEAD is now at b67d791 Initial commit
11:14:11.670
11:14:11.779
11:14:11.808 Success: Finished cloning repository files
11:14:12.602 Installing dependencies
11:14:12.609 Python version set to 2.7
11:14:16.019 Downloading and installing node v17.9.1...
11:14:16.308 Downloading https://nodejs.org/dist/v17.9.1/node-v17.9.1-linux-x64.tar.xz...
11:14:16.620 Computing checksum with sha256sum
11:14:16.747 Checksums matched!
11:14:21.690 Now using node v17.9.1 (npm v8.11.0)
11:14:21.976 Started restoring cached build plugins
11:14:21.984 Finished restoring cached build plugins
11:14:22.378 Attempting ruby version 2.7.1, read from environment
11:14:23.991 Using /opt/buildhome/.rvm/gems/ruby-2.7.1
11:14:24.978 Using PHP version 5.6
11:14:25.070 5.2.5 is already installed.
11:14:25.087 Using Swift version 5.2.5
11:14:25.087 Started restoring cached node modules
11:14:25.099 Finished restoring cached node modules
11:14:25.613 Installing NPM modules using NPM version 8.11.0
11:14:26.798 npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:14:26.798 npm WARN config location in the cache, and they are managed by
11:14:26.798 npm WARN config [`cacache`](http://npm.im/cacache).
11:14:27.196 npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:14:27.197 npm WARN config location in the cache, and they are managed by
11:14:27.197 npm WARN config [`cacache`](http://npm.im/cacache).
11:14:27.490 npm WARN EBADENGINE Unsupported engine {
11:14:27.490 npm WARN EBADENGINE package: '[email protected]',
11:14:27.490 npm WARN EBADENGINE required: { node: '^14.18.0 || ^16.14.0 || >=18.0.0' },
11:14:27.490 npm WARN EBADENGINE current: { node: 'v17.9.1', npm: '8.11.0' }
11:14:27.491 npm WARN EBADENGINE }
11:14:38.177
11:14:38.178 added 286 packages, and audited 287 packages in 11s
11:14:38.178
11:14:38.178 116 packages are looking for funding
11:14:38.178 run `npm fund` for details
11:14:38.179
11:14:38.179 found 0 vulnerabilities
11:14:38.202 NPM modules installed
11:14:38.271 Installing Hugo 0.54.0
11:14:38.957 Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
11:14:38.961 Started restoring cached go cache
11:14:38.974 Finished restoring cached go cache
11:14:39.063 go version go1.14.4 linux/amd64
11:14:39.079 go version go1.14.4 linux/amd64
11:14:39.084 Installing missing commands
11:14:39.084 Verify run directory
11:14:39.084 Executing user command: npx @cloudflare/next-on-pages@1
11:14:39.591 npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:14:39.592 npm WARN config location in the cache, and they are managed by
11:14:39.592 npm WARN config [`cacache`](http://npm.im/cacache).
11:14:40.225 npm WARN exec The following package was not found and will be installed: @cloudflare/next-on-pages@1
11:14:57.709 npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
11:14:57.944 npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
11:15:00.243 npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
11:16:18.347 ⚡️ @cloudflare/next-on-pages CLI v.1.1.0
11:16:18.349 ⚡️ Detected Package Manager: npm
11:16:18.350 ⚡️ Preparing project...
11:16:18.352 ⚡️ Project is ready
11:16:18.352 ⚡️ Building project...
11:16:18.865 ▲ npm
11:16:18.866 ▲ WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:16:18.866 ▲ npm WARN config location in the cache, and they are managed by
11:16:18.866 ▲ npm WARN config [`cacache`](http://npm.im/cacache).
11:16:19.361 ▲ npm
11:16:19.361 ▲ WARN exec The following package was not found and will be installed: vercel
11:16:26.886 ▲ npm WARN
11:16:26.887 ▲ deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
11:16:31.824 ▲ Vercel CLI 30.2.2
11:16:32.132 ▲ Installing dependencies...
11:16:32.641 ▲ npm
11:16:32.641 ▲ WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:16:32.641 ▲ npm WARN
11:16:32.641 ▲ config location in the cache, and they are managed by
11:16:32.642 ▲ npm
11:16:32.642 ▲ WARN config
11:16:32.642 ▲ [`cacache`](http://npm.im/cacache).
11:16:32.922 ▲ npm WARN
11:16:32.922 ▲ EBADENGINE Unsupported engine {
11:16:32.922 ▲ npm WARN EBADENGINE package: '[email protected]',
11:16:32.922 ▲ npm WARN EBADENGINE required: { node: '^14.18.0 || ^16.14.0 || >=18.0.0' },
11:16:32.922 ▲ npm
11:16:32.923 ▲ WARN EBADENGINE current: { node: 'v17.9.1', npm: '8.11.0' }
11:16:32.923 ▲ npm WARN EBADENGINE }
11:16:33.138 ▲ up to date in 527ms
11:16:33.139 ▲ 116 packages are looking for funding
11:16:33.139 ▲ run `npm fund` for details
11:16:33.151 ▲ Detected Next.js version: 13.4.6
11:16:33.155 ▲ Detected `package-lock.json` generated by npm 7+...
11:16:33.156 ▲ Running "npm run build"
11:16:33.652 ▲ npm
11:16:33.652 ▲
11:16:33.653 ▲ WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:16:33.653 ▲ npm WARN
11:16:33.653 ▲ config location in the cache, and they are managed by
11:16:33.653 ▲ npm WARN config [`cacache`](http://npm.im/cacache).
11:16:33.670 ▲ > [email protected] build
11:16:33.670 ▲ > next build
11:16:34.519 ▲ Attention: Next.js now collects completely anonymous telemetry regarding usage.
11:16:34.520 ▲ This information is used to shape Next.js' roadmap and prioritize features.
11:16:34.520 ▲ 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:
11:16:34.520 ▲ https://nextjs.org/telemetry
11:16:34.657 ▲ - info Creating an optimized production build...
11:16:42.651 ▲ - info Compiled successfully
11:16:42.653 ▲ - info Linting and checking validity of types...
11:16:44.918 ▲ - info Collecting page data...
11:16:57.371 ▲ - info Generating static pages (0/4)
11:16:57.529 ▲ (node:1833) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
11:16:57.530 ▲ (Use `node --trace-warnings ...` to show where the warning was created)
11:16:57.550 ▲ - info Generating static pages (1/4)
11:16:57.576 ▲ - info Generating static pages (2/4)
11:16:57.651 ▲ - info Generating static pages (3/4)
11:16:57.811 ▲ - info Generating static pages (4/4)
11:16:57.846 ▲ - info Finalizing page optimization...
11:16:57.852 ▲
11:16:57.867 ▲ Route (app) Size First Load JS
11:16:57.868 ▲ ┌ ○ / 0 B 0 B
11:16:57.868 ▲ ├ ℇ /api 0 B 0 B
11:16:57.868 ▲ └ ○ /favicon.ico 0 B 0 B
11:16:57.868 ▲ + First Load JS shared by all 77.6 kB
11:16:57.868 ▲ ├ chunks/769-8ab68f842512379f.js 25.2 kB
11:16:57.868 ▲ ├ chunks/bce60fc1-49ee79ad31766ac6.js 50.5 kB
11:16:57.869 ▲ ├ chunks/main-app-714943d41e2c0e30.js 216 B
11:16:57.869 ▲ └ chunks/webpack-2e29b75f8be838b1.js 1.64 kB
11:16:57.869 ▲
11:16:57.869 ▲ Route (pages) Size First Load JS
11:16:57.869 ▲ ─ ○ /404 182 B 74.7 kB
11:16:57.869 ▲ + First Load JS shared by all 74.6 kB
11:16:57.869 ▲ ├ chunks/framework-8883d1e9be70c3da.js 45 kB
11:16:57.869 ▲ ├ chunks/main-c52221ef4817f039.js 27.7 kB
11:16:57.870 ▲ ├ chunks/pages/_app-998b8fceeadee23e.js 195 B
11:16:57.870 ▲ └ chunks/webpack-2e29b75f8be838b1.js 1.64 kB
11:16:57.870 ▲ ℇ (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components)
11:16:57.870 ▲ ○ (Static) automatically rendered as static HTML (uses no initial props)
11:17:02.710 ▲ Traced Next.js server files in: 4.129s
11:17:05.468 ▲ Created all serverless functions in: 2.758s
11:17:05.529 ▲ Collected static files (public/, static/, .next/static): 10.234ms
11:17:06.516 ▲ Build Completed in .vercel/output [34s]
11:17:06.657 ⚡️ Completed `npx vercel build`.
11:17:07.148 ⚡️ Generated '.vercel/output/static/_worker.js/index.js'.
11:17:07.197 Finished
11:17:07.197 Found _worker.js in output directory. Uploading.
11:17:07.806 Uploading additional modules:
11:17:07.807 - __next-on-pages-dist__/chunks/114.js (esm)
11:17:07.807 - __next-on-pages-dist__/chunks/126.js (esm)
11:17:07.807 - __next-on-pages-dist__/chunks/195.js (esm)
11:17:07.807 - __next-on-pages-dist__/chunks/336.js (esm)
11:17:07.807 - __next-on-pages-dist__/chunks/37.js (esm)
11:17:07.807 - __next-on-pages-dist__/chunks/379.js (esm)
11:17:07.807 - __next-on-pages-dist__/chunks/390.js (esm)
11:17:07.808 - __next-on-pages-dist__/chunks/420.js (esm)
11:17:07.808 - __next-on-pages-dist__/chunks/471.js (esm)
11:17:07.808 - __next-on-pages-dist__/chunks/533.js (esm)
11:17:07.809 - __next-on-pages-dist__/chunks/562.js (esm)
11:17:07.809 - __next-on-pages-dist__/chunks/645.js (esm)
11:17:07.809 - __next-on-pages-dist__/chunks/744.js (esm)
11:17:07.809 - __next-on-pages-dist__/chunks/765.js (esm)
11:17:07.810 - __next-on-pages-dist__/chunks/798.js (esm)
11:17:07.810 - __next-on-pages-dist__/chunks/823.js (esm)
11:17:07.810 - __next-on-pages-dist__/chunks/868.js (esm)
11:17:07.810 - __next-on-pages-dist__/chunks/876.js (esm)
11:17:07.810 - __next-on-pages-dist__/chunks/937.js (esm)
11:17:07.811 - __next-on-pages-dist__/chunks/971.js (esm)
11:17:07.811 - __next-on-pages-dist__/chunks/986.js (esm)
11:17:07.811 - __next-on-pages-dist__/chunks/994.js (esm)
11:17:07.811 - __next-on-pages-dist__/functions/api.func.js (esm)
11:17:07.865 ✨ Compiled Worker successfully
11:17:07.936 Found _routes.json in output directory. Uploading.
11:17:07.953 Validating asset output directory
11:17:14.661 Success: Assets published!
11:17:16.005 Error: Failed to publish your Function. Got error: Uncaught Error: No such module "opt/buildhome/repo/.vercel/output/static/_worker.js/index.js".
imported from "bundledWorker-0.9936993478245977.mjs"
Any advice? Thanks!