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

Build & Deploy success, but shows: Internal Server Error #43

Closed willin closed 1 year ago

willin commented 1 year ago
15:23:25.262 | Cloning repository...
-- | --
15:23:26.192 | From https://github.com/willin/nextjs-13-on-both-vercel-cloudflare
15:23:26.192 | * branch            7949098072ec1da2973c22dee89c7f140352759c -> FETCH_HEAD
15:23:26.192 |  
15:23:26.252 | HEAD is now at 7949098 feat: i18n
15:23:26.253 |  
15:23:26.389 |  
15:23:26.414 | Success: Finished cloning repository files
15:23:27.090 | Installing dependencies
15:23:27.101 | Python version set to 2.7
15:23:30.312 | Downloading and installing node v16.19.0...
15:23:30.732 | Downloading https://nodejs.org/dist/v16.19.0/node-v16.19.0-linux-x64.tar.xz...
15:23:31.227 | Computing checksum with sha256sum
15:23:31.357 | Checksums matched!
15:23:35.699 | Now using node v16.19.0 (npm v8.19.3)
15:23:36.085 | Started restoring cached build plugins
15:23:36.098 | Finished restoring cached build plugins
15:23:36.565 | Attempting ruby version 2.7.1, read from environment
15:23:39.988 | Using ruby version 2.7.1
15:23:40.348 | Using PHP version 5.6
15:23:40.509 | 5.2 is already installed.
15:23:40.535 | Using Swift version 5.2
15:23:40.536 | Started restoring cached node modules
15:23:40.552 | Finished restoring cached node modules
15:23:41.051 | Installing NPM modules using NPM version 8.19.3
15:23:41.464 | npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:23:41.465 | npm WARN config location in the cache, and they are managed by
15:23:41.465 | npm WARN config     [`cacache`](http://npm.im/cacache).
15:23:41.863 | npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:23:41.864 | npm WARN config location in the cache, and they are managed by
15:23:41.864 | npm WARN config     [`cacache`](http://npm.im/cacache).
15:23:51.791 |  
15:23:51.791 | > next-13-demo@0.1.0 prepare
15:23:51.791 | > husky install
15:23:51.792 |  
15:23:51.904 | husky - Git hooks installed
15:23:51.936 |  
15:23:51.936 | added 390 packages, and audited 391 packages in 10s
15:23:51.937 |  
15:23:51.937 | 129 packages are looking for funding
15:23:51.937 | run `npm fund` for details
15:23:51.938 |  
15:23:51.938 | found 0 vulnerabilities
15:23:51.952 | NPM modules installed
15:23:52.516 | npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:23:52.517 | npm WARN config location in the cache, and they are managed by
15:23:52.517 | npm WARN config     [`cacache`](http://npm.im/cacache).
15:23:52.535 | Installing Hugo 0.54.0
15:23:53.219 | Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
15:23:53.223 | Started restoring cached go cache
15:23:53.242 | Finished restoring cached go cache
15:23:53.386 | go version go1.14.4 linux/amd64
15:23:53.401 | go version go1.14.4 linux/amd64
15:23:53.403 | Installing missing commands
15:23:53.404 | Verify run directory
15:23:53.404 | Executing user command: npx @cloudflare/next-on-pages --experimental-minify
15:23:53.873 | npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:23:53.874 | npm WARN config location in the cache, and they are managed by
15:23:53.874 | npm WARN config     [`cacache`](http://npm.im/cacache).
15:23:54.634 | npm WARN exec The following package was not found and will be installed: @cloudflare/next-on-pages@0.2.0
15:24:01.546 | ⚡️ @cloudflare/next-to-pages CLI
15:24:01.550 | ⚡️
15:24:01.550 | ⚡️ Installing 'vercel' CLI...
15:24:01.550 | ⚡️
15:24:02.058 | ▲ npm
15:24:02.059 | ▲  WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:24:02.059 | ▲ npm WARN config location in the cache, and they are managed by
15:24:02.059 | ▲ npm WARN config     [`cacache`](http://npm.im/cacache).
15:24:02.059 | ▲
15:24:06.740 | ▲
15:24:06.740 | ▲ added 180 packages, and audited 571 packages in 5s
15:24:06.740 | ▲
15:24:06.740 | ▲
15:24:06.741 | ▲ 145 packages are looking for funding
15:24:06.741 | ▲   run `npm fund` for details
15:24:06.741 | ▲
15:24:06.748 | ▲
15:24:06.749 | ▲ 5 moderate severity vulnerabilities
15:24:06.749 | ▲
15:24:06.749 | ▲ To address all issues, run:
15:24:06.750 | ▲   npm audit fix
15:24:06.751 | ▲
15:24:06.751 | ▲ Run `npm audit` for details.
15:24:06.751 | ▲
15:24:06.763 | ⚡️
15:24:06.763 | ⚡️
15:24:06.763 | ⚡️ Completed 'npx vercel build'.
15:24:06.763 | ⚡️
15:24:06.763 | ⚡️
15:24:06.763 | ⚡️ Building project with 'npx vercel build'...
15:24:06.764 | ⚡️
15:24:07.282 | ▲ npm
15:24:07.282 | ▲  WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:24:07.282 | ▲ npm WARN
15:24:07.282 | ▲  config location in the cache, and they are managed by
15:24:07.282 | ▲ npm WARN config     [`cacache`](http://npm.im/cacache).
15:24:07.282 | ▲
15:24:08.057 | ▲ Vercel CLI 28.9.0
15:24:08.057 | ▲
15:24:08.451 | ▲ Installing dependencies...
15:24:08.451 | ▲
15:24:08.866 | ▲ npm
15:24:08.866 | ▲  WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:24:08.866 | ▲ npm WARN
15:24:08.866 | ▲  config location in the cache, and they are managed by
15:24:08.866 | ▲ npm
15:24:08.867 | ▲  WARN config
15:24:08.867 | ▲      [`cacache`](http://npm.im/cacache).
15:24:08.867 | ▲
15:24:09.720 | ▲
15:24:09.720 | ▲ > next-13-demo@0.1.0 prepare
15:24:09.720 | ▲ > husky install
15:24:09.721 | ▲
15:24:09.721 | ▲
15:24:09.839 | ▲ husky - Git hooks installed
15:24:09.839 | ▲
15:24:09.855 | ▲
15:24:09.855 | ▲ up to date in 1s
15:24:09.855 | ▲
15:24:09.855 | ▲
15:24:09.856 | ▲ 145 packages are looking for funding
15:24:09.856 | ▲   run `npm fund` for details
15:24:09.856 | ▲
15:24:09.867 | ▲ Detected Next.js version: 13.0.7
15:24:09.868 | ▲
15:24:09.876 | ▲ Detected `package-lock.json` generated by npm 7+...
15:24:09.876 | ▲
15:24:09.876 | ▲ Running "npm run build"
15:24:09.877 | ▲
15:24:10.354 | ▲ npm
15:24:10.355 | ▲  WARN config tmp This setting is no longer used.  npm stores temporary files in a special
15:24:10.355 | ▲
15:24:10.355 | ▲ npm WARN config location in the cache, and they are managed by
15:24:10.355 | ▲ npm WARN config     [`cacache`](http://npm.im/cacache).
15:24:10.356 | ▲
15:24:10.371 | ▲
15:24:10.371 | ▲ > next-13-demo@0.1.0 build
15:24:10.372 | ▲ > next build
15:24:10.372 | ▲
15:24:10.372 | ▲
15:24:10.957 | ▲ warn  - You have enabled experimental features (appDir, runtime) in next.config.js.
15:24:10.957 | ▲
15:24:10.957 | ▲ warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
15:24:10.957 | ▲
15:24:10.958 | ▲
15:24:10.958 | ▲
15:24:10.958 | ▲ info  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
15:24:10.958 | ▲
15:24:11.000 | ▲ Attention: Next.js now collects completely anonymous telemetry regarding usage.
15:24:11.000 | ▲ This information is used to shape Next.js' roadmap and prioritize features.
15:24:11.000 | ▲
15:24:11.000 | ▲ 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:
15:24:11.000 | ▲ https://nextjs.org/telemetry
15:24:11.001 | ▲
15:24:11.001 | ▲
15:24:11.136 | ▲ info  - Creating an optimized production build...
15:24:11.136 | ▲
15:24:11.468 | ▲ warn  - You are using the experimental Edge Runtime with `experimental.runtime`.
15:24:11.469 | ▲
15:24:19.590 | ▲
15:24:19.590 | ▲
15:24:19.590 | ▲ 🌼 daisyUI components 2.43.2  https://daisyui.com
15:24:19.590 | ▲
15:24:19.730 | ▲   ✔︎ Including:  base, components, 29 themes, utilities
15:24:19.731 | ▲   ❤︎ Support daisyUI:  https://opencollective.com/daisyui
15:24:19.732 | ▲
15:24:19.733 | ▲
15:24:22.028 | ▲ info  - Compiled successfully
15:24:22.028 | ▲
15:24:22.028 | ▲ info  - Linting and checking validity of types...
15:24:22.028 | ▲
15:24:26.930 | ▲ info  - Collecting page data...
15:24:26.931 | ▲
15:24:32.276 | ▲ info  - Generating static pages (0/2)
15:24:32.277 | ▲
15:24:32.375 | ▲ info  - Generating static pages (2/2)
15:24:32.376 | ▲
15:24:32.386 | ▲ info  - Finalizing page optimization...
15:24:32.387 | ▲
15:24:32.391 | ▲
15:24:32.391 | ▲
15:24:32.412 | ▲ Route (app)                                Size     First Load JS
15:24:32.412 | ▲ ┌ ℇ /                                      0 B                0 B
15:24:32.412 | ▲ ├ ℇ /[locale]                              189 B          66.8 kB
15:24:32.412 | ▲ └ ℇ /[locale]/demo                         142 B          66.8 kB
15:24:32.412 | ▲ + First Load JS shared by all              66.7 kB
15:24:32.412 | ▲   ├ chunks/17-f57ea74361402803.js          64.4 kB
15:24:32.413 | ▲   ├ chunks/main-app-9eeb59fe16a6f839.js    200 B
15:24:32.413 | ▲   └ chunks/webpack-781e30d13efd61dd.js     2.1 kB
15:24:32.413 | ▲
15:24:32.413 | ▲ Route (pages)                              Size     First Load JS
15:24:32.413 | ▲ ┌ ○ /404                                   179 B          81.6 kB
15:24:32.413 | ▲ └ ℇ /api/hello                             0 B            81.4 kB
15:24:32.414 | ▲ + First Load JS shared by all              81.4 kB
15:24:32.414 | ▲   ├ chunks/main-90541af5d453807f.js        79.1 kB
15:24:32.414 | ▲   ├ chunks/pages/_app-5841ab2cb3aa228d.js  192 B
15:24:32.414 | ▲   └ chunks/webpack-781e30d13efd61dd.js     2.1 kB
15:24:32.414 | ▲
15:24:32.414 | ▲
15:24:32.414 | ▲ ℇ  (Streaming)  server-side renders with streaming (uses React 18 SSR streaming or Server Components)
15:24:32.414 | ▲ ○  (Static)     automatically rendered as static HTML (uses no initial props)
15:24:32.414 | ▲
15:24:32.415 | ▲
15:24:33.820 | ▲ Traced Next.js server files in: 1.253s
15:24:33.820 | ▲
15:24:35.411 | ▲ Created all serverless functions in: 1.591s
15:24:35.411 | ▲
15:24:35.714 | ▲ Collected static files (public/, static/, .next/static): 8.896ms
15:24:35.714 | ▲
15:24:35.812 | ▲ Build Completed in .vercel/output [27s]
15:24:35.812 | ▲
15:24:35.887 | ⚡️
15:24:35.887 | ⚡️
15:24:35.887 | ⚡️ Completed 'npx vercel build'.
15:24:35.887 | ⚡️
15:24:37.318 | ⚡️ Generated '.vercel/output/static/_worker.js'.
15:24:37.367 | Finished
15:24:37.367 | Found _worker.js in output directory. Uploading.
15:24:37.396 | Validating asset output directory
15:24:38.183 | Deploying your site to Cloudflare's global network...
15:24:41.944 | Uploading... (23/33)
15:24:41.945 |  
15:24:42.687 | AAG Uploading... (26/33)
15:24:42.687 |  
15:24:42.770 | AAG Uploading... (29/33)
15:24:42.770 |  
15:24:43.936 | AAG Uploading... (33/33)
15:24:43.937 |  
15:24:43.940 | ✨ Success! Uploaded 10 files (23 already uploaded) (2.51 sec)
15:24:43.940 |  
15:24:44.476 | ✨ Upload complete!
15:24:45.880 | Success: Assets published!
15:24:47.731 | Success: Your site was deployed!
image
chromonav commented 1 year ago

+1 facing the same issue, static export worked though, not working for v12 also.

EvanScoboria commented 1 year ago

@willin it looks like you have dynamic routes at app/[locale]. Dynamic routes are not currently working. See #32 #35

mhamrah commented 1 year ago

This happened to me and was due to the experimental app support. Bootstrapping with app support works.

danburonline commented 1 year ago

@mhamrah Can you elaborate on what you mean by this? I'm facing the same issue.

mhamrah commented 1 year ago

If you bootstrap a new next project and opt-in to the experimental app support (where pages and app are separate folders, see https://nextjs.org/docs/basic-features/pages for more info) you face this issue. If you don't opt into that when you run create-next-app you're fine.

danburonline commented 1 year ago

@mhamrah Ah yes, that makes sense. Thanks for clarifying

jesse996 commented 1 year ago

If you bootstrap a new next project and opt-in to the experimental app support (where pages and app are separate folders, see https://nextjs.org/docs/basic-features/pages for more info) you face this issue. If you don't opt into that when you run create-next-app you're fine.

when will it support the experimental app feature?

erickeira commented 1 year ago

Está usando o expetimental-edge?

oxodesign commented 1 year ago

Im facing same issue, any workaround? When will this be supported?

dario-piotrowicz commented 1 year ago

@willin I'm so sorry for the later reply and for this having taken this long 🙇

anyways I think It should be all good now it you use next-on-pages v1, as you can see here: https://a253972b.next-on-pages-test-5h3.pages.dev/

To use v1 To use v1 simple update your build command to: ```diff - npx @cloudflare/next-on-pages + npx @cloudflare/next-on-pages@1 ``` (from now on we also suggest installing it as a dependency of the project, so you should also do: `npm i -D @cloudflare/next-on-pages@1` but things do work even if you only update the build command)

So I am closing this issue as I believe that it's been solved, @willin please have a look, if you still have some problems we can always reopen this issue 🙂