Failed to build on GitHub Actions with Next.js 12.3
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000
Binaries:
Node: 16.14.2
npm: 8.7.0
Yarn: 1.22.10
pnpm: 6.11.0
Relevant packages:
next: 12.3.2-canary.7
eslint-config-next: N/A
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
npm run build
is keep failing with the following error message on GitHub Actions, however, it’s build success on my computer and Vercel:
info - Compiled successfully
info - Collecting page data...
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:371:5)
at onParseError (node:internal/url:5[52](https://github.com/thematters/matters-web/actions/runs/3111145523/jobs/5043100695#step:9:52):9)
at new URL (node:internal/url:628:5)
at Object.6926 (/home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:44:1)
at __webpack_require__ (/home/runner/work/matters-web/matters-web/.next/server/webpack-runtime.js:25:42)
at __webpack_exec__ (/home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:168:39)
at /home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:169:71
at Function.__webpack_require__.X (/home/runner/work/matters-web/matters-web/.next/server/webpack-runtime.js:207:21)
at /home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:169:47
at Object.<anonymous> (/home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:172:3) {
input: 'undefined',
code: 'ERR_INVALID_URL'
}
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:371:5)
at onParseError (node:internal/url:552:9)
at new URL (node:internal/url:628:5)
at Object.6926 (/home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:44:1)
at __webpack_require__ (/home/runner/work/matters-web/matters-web/.next/server/webpack-runtime.js:25:42)
at __webpack_exec__ (/home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:168:39)
at /home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:169:71
at Function.__webpack_require__.X (/home/runner/work/matters-web/matters-web/.next/server/webpack-runtime.js:207:21)
at /home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:169:47
at Object.<anonymous> (/home/runner/work/matters-web/matters-web/.next/server/pages/_document.js:172:3) {
input: 'undefined',
code: 'ERR_INVALID_URL'
}
> Build error occurred
Error: Failed to collect page data for /404
at /home/runner/work/matters-web/matters-web/node_modules/next/dist/build/utils.js:916:15
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
type: 'Error'
}
Expected Behavior
Build successfully
Link to reproduction
https://github.com/thematters/matters-web/pull/2766
To Reproduce
Run npm run build
on both GitHub Actions and local computer.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
12.3.x causes Collecting page data to fail during build #40834
12.3.x causes Collecting page data to fail during build #40834 ... I verified that the issue exists in the latest Next.js canary release ......
Read more >next.js built from source errors when linked to build ... - GitHub
Next.js builds from source, but using it to build another project fails. I have gotten various errors from various ways of doing this....
Read more >After updating to Next 12.3.0 or 12.3.1 (from 12.2.5) cannot ...
The issue was in my next.config.js file. Setting the swcMinify value to false, fixed this issue and the error is not thrown on...
Read more >Github action production build fail at next build: since I ...
Since I switched from v11 to v12 I can't get my nextjs site deployed with github actions. I receive this weird error that...
Read more >Menu don't work in nextjs 12.3.1 · Issue #38106 · ant-design ...
Reproduction link https://github.com/ccdarvin/authcloud.git Steps to reproduce We have a menu in side left of page, when click in link ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@robertu7
The
new URL
is introduced by~/enum/csp
, which is being used in_document
. That’s how I found it.AFAIK Next.js doesn’t change
_document
parts recently, it is more likely related to how Next.js 12.3 handles.env.*
files.This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.