Cloudflare Pages error "Failed: an internal error occurred"

I’m using Cloudflare Pages and receiving this generic error during the “Deploying to Cloudflare’s global network” step: Failed: an internal error occurred.

I’ve tried replaying the build, setting the branch to main to see if the problem is with previews, and deleting the site entirely and starting over. Nothing has worked.

All other steps including site build and worker compilation succeed consistently.

GitHub repo of the site I’m building:

https://github.com/tyhopp/tysite/tree/cloudflare

Logs from failed Cloudflare Pages run, the last line being the error I receive every time:

19:35:04.674	Initializing build environment. This may take up to a few minutes to complete
19:37:11.592	Success: Finished initializing build environment
19:37:11.592	Cloning repository...
19:37:14.992	Success: Finished cloning repository files
19:37:15.940	Installing dependencies
19:37:15.944	Python version set to 2.7
19:37:16.990	Downloading and installing node v14.17.5...
19:37:17.169	Downloading https://nodejs.org/dist/v14.17.5/node-v14.17.5-linux-x64.tar.xz...
19:37:17.516	Computing checksum with sha256sum
19:37:17.628	Checksums matched!
19:37:19.998	Now using node v14.17.5 (npm v6.14.14)
19:37:20.073	Started restoring cached build plugins
19:37:20.075	Finished restoring cached build plugins
19:37:20.190	Attempting ruby version 2.7.1, read from environment
19:37:21.115	Using ruby version 2.7.1
19:37:21.345	Using PHP version 5.6
19:37:21.375	5.2 is already installed.
19:37:21.381	Using Swift version 5.2
19:37:21.381	Started restoring cached node modules
19:37:21.384	Finished restoring cached node modules
19:37:21.544	Installing NPM modules using NPM version 6.14.14
19:37:22.143	npm WARN read-shrinkwrap This version of npm is compatible with [email protected], but package-lock.json was generated for [email protected] I'll try to do my best with it!
19:37:24.608	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
19:37:24.609	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19:37:24.609	
19:37:24.611	added 65 packages from 124 contributors and audited 66 packages in 2.508s
19:37:24.637	
19:37:24.637	5 packages are looking for funding
19:37:24.637	  run `npm fund` for details
19:37:24.637	
19:37:24.638	found 0 vulnerabilities
19:37:24.638	
19:37:24.653	NPM modules installed
19:37:24.884	Installing Hugo 0.54.0
19:37:26.003	Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
19:37:26.004	Started restoring cached go cache
19:37:26.008	Finished restoring cached go cache
19:37:26.035	go version go1.14.4 linux/amd64
19:37:26.040	go version go1.14.4 linux/amd64
19:37:26.041	Installing missing commands
19:37:26.041	Verify run directory
19:37:26.041	Executing user command: npm run build
19:37:26.275	
19:37:26.275	> [email protected] build /opt/buildhome/repo
19:37:26.275	> rm -rf dist && node scripts/fetch.js && node scripts/build.js
19:37:26.275	
19:37:40.013	e[35m [PRPL] Fetched remote content e[0m
19:37:40.170	e[35m [PRPL] Build complete e[0m
19:37:40.188	e[35m [PRPL] Resolved HTML imports e[0m
19:37:40.194	e[35m [PRPL] Resolved CSS imports e[0m
19:37:40.345	e[35m [PRPL] Highlighted code e[0m
19:37:40.352	e[35m [PRPL] Generated RSS feed e[0m
19:37:40.357	e[35m [PRPL] Generated sitemap e[0m
19:37:40.373	Finished
19:37:40.494	Compiling worker to "/opt/pages/functions/user-worker.js"
19:37:40.502	Finished in 41ms.
19:37:40.508	Validating asset output directory
19:37:41.835	Deploying your site to Cloudflare's global network...
19:37:56.645	Failed: an internal error occurred

I’m aware of the elevated error rates on Pages deployment issue yesterday but am not receiving timeouts like the issue describes.

Seems from other posts here that cryptic error messages in Pages deployments is not uncommon. Would list the links but new users here are only allowed 4 links per post.

It’s understandable given that Pages is a relatively new product and that internal generic errors can be a security strategy, but it is frustrating to not know whether this is something I can fix without reaching out to support.

Really appreciate any help anyone can offer.

Thanks,
Ty

As it’s been a few days with no reply, you’ll probably get more bites where the Pages devs hang out:

1 Like

Thanks @sdayman for pointing me to the Discord.

For anyone else reading this, my particular issue was caused by trying to access process.env in the pages function. Using wrangler2 to debug the function locally helped a bunch: GitHub - cloudflare/wrangler2: PRELEASE of V2 - 🤠 wrangle your Cloudflare Workers

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.