cloudflare / next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages
https://www.npmjs.com/package/@cloudflare/next-on-pages
MIT License
1.28k stars 125 forks source link

ERROR: Could not map all functions to an entry in the manifest. #77

Closed Dope-Ass-Ninja closed 1 year ago

Dope-Ass-Ninja commented 1 year ago

Trying to build a basic Next.Js and get it to build on CloudFlare Pages.

Next.JS version: 13.2.1 Node Version: 16.14.0

Using experimental app feature, as well as the experimental edge feature.

Steps to reproduce:

  1. create fresh next js website using experimental app structure, and experimental edge in nextjs config
  2. deploy to cloudflare with build command npx @cloudflare/next-on-pages --experimental-minify

Log: 2023-02-24T06:10:53.459676Z Cloning repository... 2023-02-24T06:10:56.140607Z warning: redirecting to https://gitlab.com/Dope-Ass-Ninja/twitch-website.git/ 2023-02-24T06:10:56.141211Z From https://gitlab.com/Dope-Ass-Ninja/twitch-website 2023-02-24T06:10:56.141395Z * branch bc588dec79a93057cb53876e9874ca220aca2b6d -> FETCH_HEAD 2023-02-24T06:10:56.141521Z 2023-02-24T06:10:56.252539Z HEAD is now at bc588de again 2023-02-24T06:10:56.253154Z 2023-02-24T06:10:56.404233Z 2023-02-24T06:10:56.430214Z Success: Finished cloning repository files 2023-02-24T06:10:57.141016Z Installing dependencies 2023-02-24T06:10:57.151815Z Python version set to 2.7 2023-02-24T06:11:00.389541Z Downloading and installing node v16.14.0... 2023-02-24T06:11:00.805429Z Downloading https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz... 2023-02-24T06:11:01.2218Z Computing checksum with sha256sum 2023-02-24T06:11:01.35146Z Checksums matched! 2023-02-24T06:11:05.575908Z Now using node v16.14.0 (npm v8.3.1) 2023-02-24T06:11:05.946659Z Started restoring cached build plugins 2023-02-24T06:11:05.959794Z Finished restoring cached build plugins 2023-02-24T06:11:06.433441Z Attempting ruby version 2.7.1, read from environment 2023-02-24T06:11:09.927665Z Using ruby version 2.7.1 2023-02-24T06:11:10.289894Z Using PHP version 5.6 2023-02-24T06:11:10.448854Z 5.2 is already installed. 2023-02-24T06:11:10.474787Z Using Swift version 5.2 2023-02-24T06:11:10.475834Z Started restoring cached node modules 2023-02-24T06:11:10.492038Z Finished restoring cached node modules 2023-02-24T06:11:10.971369Z Installing NPM modules using NPM version 8.3.1 2023-02-24T06:11:23.625488Z 2023-02-24T06:11:23.625825Z added 317 packages, and audited 318 packages in 12s 2023-02-24T06:11:23.626Z 2023-02-24T06:11:23.626128Z 113 packages are looking for funding 2023-02-24T06:11:23.626268Z runnpm fundfor details 2023-02-24T06:11:23.626936Z 2023-02-24T06:11:23.627187Z found 0 vulnerabilities 2023-02-24T06:11:23.647374Z NPM modules installed 2023-02-24T06:11:24.227586Z Installing Hugo 0.54.0 2023-02-24T06:11:24.921349Z Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z 2023-02-24T06:11:24.925788Z Started restoring cached go cache 2023-02-24T06:11:24.945219Z Finished restoring cached go cache 2023-02-24T06:11:25.096007Z go version go1.14.4 linux/amd64 2023-02-24T06:11:25.111015Z go version go1.14.4 linux/amd64 2023-02-24T06:11:25.114008Z Installing missing commands 2023-02-24T06:11:25.114253Z Verify run directory 2023-02-24T06:11:25.114389Z Executing user command: npx @cloudflare/next-on-pages --experimental-minify 2023-02-24T06:11:26.119238Z npm WARN exec The following package was not found and will be installed: @cloudflare/next-on-pages 2023-02-24T06:11:40.548569Z npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead 2023-02-24T06:11:41.027998Z npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject. 2023-02-24T06:11:42.051464Z npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs 2023-02-24T06:11:49.026706Z ⚡️ @cloudflare/next-on-pages CLI 2023-02-24T06:11:49.031162Z ⚡️ 2023-02-24T06:11:49.031511Z ⚡️ Installing 'vercel' CLI... 2023-02-24T06:11:49.031733Z ⚡️ 2023-02-24T06:11:56.145372Z ▲ npm 2023-02-24T06:11:56.146277Z ▲ WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs 2023-02-24T06:11:56.146516Z ▲ 2023-02-24T06:11:56.376402Z ▲ npm 2023-02-24T06:11:56.377037Z ▲ WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject. 2023-02-24T06:11:56.377274Z ▲ 2023-02-24T06:11:56.528508Z ▲ npm 2023-02-24T06:11:56.528792Z ▲ WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead 2023-02-24T06:11:56.528932Z ▲ 2023-02-24T06:11:59.690961Z ▲ 2023-02-24T06:11:59.691334Z ▲ added 663 packages, and audited 981 packages in 10s 2023-02-24T06:11:59.691515Z ▲ 2023-02-24T06:11:59.691672Z ▲ 2023-02-24T06:11:59.691831Z ▲ 240 packages are looking for funding 2023-02-24T06:11:59.69197Z ▲ runnpm fundfor details 2023-02-24T06:11:59.692116Z ▲ 2023-02-24T06:11:59.692611Z ▲ 2023-02-24T06:11:59.692885Z ▲ found 0 vulnerabilities 2023-02-24T06:11:59.693187Z ▲ 2023-02-24T06:11:59.712567Z ⚡️ 2023-02-24T06:11:59.713064Z ⚡️ 2023-02-24T06:11:59.713223Z ⚡️ Completed 'npx vercel build'. 2023-02-24T06:11:59.71335Z ⚡️ 2023-02-24T06:11:59.713475Z ⚡️ 2023-02-24T06:11:59.713621Z ⚡️ Building project with 'npx vercel build'... 2023-02-24T06:11:59.713769Z ⚡️ 2023-02-24T06:12:00.848673Z ▲ Vercel CLI 28.16.6 2023-02-24T06:12:00.849182Z ▲ 2023-02-24T06:12:01.138014Z ▲ Installing dependencies... 2023-02-24T06:12:01.138451Z ▲ 2023-02-24T06:12:02.951709Z ▲ 2023-02-24T06:12:02.952081Z ▲ up to date in 2s 2023-02-24T06:12:02.952261Z ▲ 2023-02-24T06:12:02.952416Z ▲ 2023-02-24T06:12:02.952563Z ▲ 240 packages are looking for funding 2023-02-24T06:12:02.95271Z ▲ runnpm fundfor details 2023-02-24T06:12:02.952856Z ▲ 2023-02-24T06:12:02.966143Z ▲ Detected Next.js version: 13.2.1 2023-02-24T06:12:02.966925Z ▲ 2023-02-24T06:12:02.973627Z ▲ Detectedpackage-lock.jsongenerated by npm 7+... 2023-02-24T06:12:02.973859Z ▲ 2023-02-24T06:12:02.974389Z ▲ Running "npm run build" 2023-02-24T06:12:02.974547Z ▲ 2023-02-24T06:12:03.450409Z ▲ 2023-02-24T06:12:03.450743Z ▲ > portfolio-website@0.1.0 build 2023-02-24T06:12:03.450896Z ▲ > next build 2023-02-24T06:12:03.451024Z ▲ 2023-02-24T06:12:03.451145Z ▲ 2023-02-24T06:12:04.132277Z ▲ warn - You have enabled experimental features (appDir, runtime) in next.config.js. 2023-02-24T06:12:04.132818Z ▲ 2023-02-24T06:12:04.133102Z ▲ warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk. 2023-02-24T06:12:04.133279Z ▲ 2023-02-24T06:12:04.133575Z ▲ 2023-02-24T06:12:04.133822Z ▲ 2023-02-24T06:12:04.133976Z ▲ info - Thank you for testingappDirplease leave your feedback at https://nextjs.link/app-feedback 2023-02-24T06:12:04.13425Z ▲ 2023-02-24T06:12:04.174124Z ▲ Attention: Next.js now collects completely anonymous telemetry regarding usage. 2023-02-24T06:12:04.174818Z ▲ This information is used to shape Next.js' roadmap and prioritize features. 2023-02-24T06:12:04.175039Z ▲ 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: 2023-02-24T06:12:04.175173Z ▲ 2023-02-24T06:12:04.175299Z ▲ https://nextjs.org/telemetry 2023-02-24T06:12:04.17541Z ▲ 2023-02-24T06:12:04.175522Z ▲ 2023-02-24T06:12:04.322767Z ▲ info - Creating an optimized production build... 2023-02-24T06:12:04.323073Z ▲ 2023-02-24T06:12:04.658441Z ▲ warn - You are using the experimental Edge Runtime withexperimental.runtime. 2023-02-24T06:12:04.65892Z ▲ 2023-02-24T06:12:15.468168Z ▲ info - Compiled successfully 2023-02-24T06:12:15.468516Z ▲ 2023-02-24T06:12:15.471622Z ▲ info - Linting and checking validity of types... 2023-02-24T06:12:15.472669Z ▲ 2023-02-24T06:12:17.585183Z ▲ Pages directory cannot be found at /opt/buildhome/repo/pages or /opt/buildhome/repo/src/pages. If using a custom path, please configure with theno-html-link-for-pagesrule in your eslint config file. 2023-02-24T06:12:17.585758Z ▲ 2023-02-24T06:12:18.398758Z ▲ info - Collecting page data... 2023-02-24T06:12:18.399057Z ▲ 2023-02-24T06:12:24.626638Z ▲ info - Generating static pages (0/2) 2023-02-24T06:12:24.626942Z ▲ 2023-02-24T06:12:24.715348Z ▲ info - Generating static pages (2/2) 2023-02-24T06:12:24.715657Z ▲ 2023-02-24T06:12:24.727416Z ▲ info - Finalizing page optimization... 2023-02-24T06:12:24.727738Z ▲ 2023-02-24T06:12:24.732458Z ▲ 2023-02-24T06:12:24.732729Z ▲ 2023-02-24T06:12:24.752131Z ▲ Route (app) Size First Load JS 2023-02-24T06:12:24.752423Z ▲ ┌ ℇ / 4.85 kB 78.4 kB 2023-02-24T06:12:24.75283Z ▲ ├ ℇ /api/hello 0 B 0 B 2023-02-24T06:12:24.753097Z ▲ └ ℇ /websites 138 B 68.3 kB 2023-02-24T06:12:24.753236Z ▲ + First Load JS shared by all 68.1 kB 2023-02-24T06:12:24.753354Z ▲ ├ chunks/679-c6ea71b6918a817c.js 65.8 kB 2023-02-24T06:12:24.753468Z ▲ ├ chunks/main-app-bf95c9f3913bc86b.js 205 B 2023-02-24T06:12:24.753596Z ▲ └ chunks/webpack-b211d60d542ac8c9.js 2.14 kB 2023-02-24T06:12:24.753723Z ▲ 2023-02-24T06:12:24.753833Z ▲ Route (pages) Size First Load JS 2023-02-24T06:12:24.753952Z ▲ ─ ○ /404 179 B 91.2 kB 2023-02-24T06:12:24.754073Z ▲ + First Load JS shared by all 91.1 kB 2023-02-24T06:12:24.754185Z ▲ ├ chunks/main-55868513f4df360d.js 88.7 kB 2023-02-24T06:12:24.754291Z ▲ ├ chunks/pages/_app-5841ab2cb3aa228d.js 192 B 2023-02-24T06:12:24.754707Z ▲ └ chunks/webpack-b211d60d542ac8c9.js 2.14 kB 2023-02-24T06:12:24.75492Z ▲ 2023-02-24T06:12:24.755066Z ▲ 2023-02-24T06:12:24.755205Z ▲ ℇ (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components) 2023-02-24T06:12:24.755323Z ▲ ○ (Static) automatically rendered as static HTML (uses no initial props) 2023-02-24T06:12:24.755443Z ▲ 2023-02-24T06:12:24.755555Z ▲ 2023-02-24T06:12:26.94162Z ▲ Traced Next.js server files in: 1.310s 2023-02-24T06:12:26.941953Z ▲ 2023-02-24T06:12:28.304031Z ▲ Created all serverless functions in: 1.362s 2023-02-24T06:12:28.304366Z ▲ 2023-02-24T06:12:28.568505Z ▲ Collected static files (public/, static/, .next/static): 9.674ms 2023-02-24T06:12:28.568814Z ▲ 2023-02-24T06:12:28.752665Z ▲ Build Completed in .vercel/output [28s] 2023-02-24T06:12:28.752984Z ▲ 2023-02-24T06:12:28.826034Z ⚡️ 2023-02-24T06:12:28.826372Z ⚡️ 2023-02-24T06:12:28.82653Z ⚡️ Completed 'npx vercel build'. 2023-02-24T06:12:28.826691Z ⚡️ 2023-02-24T06:12:29.797944Z ⚡️ ERROR: Could not map all functions to an entry in the manifest. 2023-02-24T06:12:29.798225Z ⚡️ Please report this at https://github.com/cloudflare/next-on-pages/issues. 2023-02-24T06:12:29.834775Z Failed: build command exited with code: 1 2023-02-24T06:12:30.768595Z Failed: an internal error occurred

gvatsov commented 1 year ago

Maybe check this issue.

shicholas commented 1 year ago

same error, I don't have basePath set like in that related issue

dario-piotrowicz commented 1 year ago

Closing as I assume this might have been an issue with an older version of next-on-pages

I've created a brand new app (repo and deployed app) via the following steps:

$ node -v
v16.14.2
$ npx create-next-app@13.2.1 next-on-pages-issue-77-test
Need to install the following packages:
  create-next-app@13.2.1
Ok to proceed? (y)
✔ Would you like to use TypeScript with this project? … No / Yes
✔ Would you like to use ESLint with this project? … No / Yes
✔ Would you like to use `src/` directory with this project? … No / Yes
✔ Would you like to use experimental `app/` directory with this project? … No / Yes
✔ What import alias would you like configured? … @/*
Creating a new Next.js app in /home/dario/Desktop/next-on-pages-issue-77-test.

applied the following to the next.config.js file (commit):

const nextConfig = {
  experimental: {
    appDir: true,
+    runtime: 'experimental-edge',
  },
}

then built the worker via:

$ npx @cloudflare/next-on-pages --experimental-minify

(no errors)

and run the app via:

$ wrangler pages dev .vercel/output/static --bundle --compatibility-flag nodejs_compat

finally I've also deployed it via:

$ wrangler pages publish .vercel/output/static --bundle

(note: I've also set the nodejs_compat compatibility flag in the Cloudflare dashboard)

Since all these steps worked as expected and produced a working app I think that this issue is no longer valid, so I am closing it @Dope-Ass-Ninja please feel free to reopen it if you still get this issue with the latest version of next-on-pages (0.5.0) (but if you do so please provide as much details and code as possible :pray:)

dario-piotrowicz commented 1 year ago

@shicholas same for you, I hope that if you try again with the latest next-on-pages it all works as expected, if you get this issues please feel free to ping me