cloudflare / pages-plugins

MIT License
57 stars 20 forks source link

@cloudflare/pages-plugin-graphql fails with an internal error occurred #24

Open remarkablemark opened 1 year ago

remarkablemark commented 1 year ago

Relates to #12

Steps to Reproduce

https://github.com/remarkablemark/cloudflare-functions-demo

I copied and pasted the Cloudflare's official doc on GraphQL Pages Plugin

Expected

No Cloudflare Pages build failure.

Actual

Build failure:

2023-03-12T23:37:48.346296Z Cloning repository...
2023-03-12T23:37:49.177812Z From https://github.com/remarkablemark/cloudflare-functions-demo
2023-03-12T23:37:49.178437Z  * branch            8df362a48bb341219070f8e6f083eb7bd2e27ae7 -> FETCH_HEAD
2023-03-12T23:37:49.17868Z  
2023-03-12T23:37:49.220667Z HEAD is now at 8df362a feat(functions): add graphql
2023-03-12T23:37:49.221262Z 
2023-03-12T23:37:49.372136Z 
2023-03-12T23:37:49.404629Z Success: Finished cloning repository files
2023-03-12T23:37:50.080897Z Installing dependencies
2023-03-12T23:37:50.092025Z Python version set to 2.7
2023-03-12T23:37:52.09027Z  Attempting node version '16' from .nvmrc
2023-03-12T23:37:53.556349Z Downloading and installing node v16.19.1...
2023-03-12T23:37:53.985716Z Downloading https://nodejs.org/dist/v16.19.1/node-v16.19.1-linux-x64.tar.xz...
2023-03-12T23:37:54.446482Z Computing checksum with sha256sum
2023-03-12T23:37:54.578234Z Checksums matched!
2023-03-12T23:37:59.077338Z Now using node v16.19.1 (npm v8.19.3)
2023-03-12T23:37:59.514748Z Started restoring cached build plugins
2023-03-12T23:37:59.529242Z Finished restoring cached build plugins
2023-03-12T23:38:00.035109Z Attempting ruby version 2.7.1, read from environment
2023-03-12T23:38:03.797687Z Using ruby version 2.7.1
2023-03-12T23:38:04.171332Z Using PHP version 5.6
2023-03-12T23:38:04.343956Z 5.2 is already installed.
2023-03-12T23:38:04.373226Z Using Swift version 5.2
2023-03-12T23:38:04.374033Z Started restoring cached node modules
2023-03-12T23:38:04.391976Z Finished restoring cached node modules
2023-03-12T23:38:04.947063Z Installing NPM modules using NPM version 8.19.3
2023-03-12T23:38:05.389871Z npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:05.390385Z npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:05.39057Z  npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:05.813524Z npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:05.814055Z npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:05.814272Z npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:07.211455Z 
2023-03-12T23:38:07.212089Z added 4 packages, and audited 5 packages in 1s
2023-03-12T23:38:07.212326Z 
2023-03-12T23:38:07.21247Z  found 0 vulnerabilities
2023-03-12T23:38:07.22347Z  NPM modules installed
2023-03-12T23:38:07.803083Z npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:07.803442Z npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:07.803638Z npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:07.823143Z Installing Hugo 0.54.0
2023-03-12T23:38:08.667354Z Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
2023-03-12T23:38:08.671785Z Started restoring cached go cache
2023-03-12T23:38:08.693349Z Finished restoring cached go cache
2023-03-12T23:38:08.84449Z  go version go1.14.4 linux/amd64
2023-03-12T23:38:08.859244Z go version go1.14.4 linux/amd64
2023-03-12T23:38:08.862244Z Installing missing commands
2023-03-12T23:38:08.862565Z Verify run directory
2023-03-12T23:38:08.862789Z Executing user command: npm install
2023-03-12T23:38:09.358137Z npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:09.35848Z  npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:09.358655Z npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:09.653146Z 
2023-03-12T23:38:09.65347Z  up to date, audited 5 packages in 326ms
2023-03-12T23:38:09.654337Z 
2023-03-12T23:38:09.654622Z found 0 vulnerabilities
2023-03-12T23:38:09.665543Z Finished
2023-03-12T23:38:09.666307Z Found Functions directory at /functions. Uploading.
2023-03-12T23:38:10.409124Z ✨ Compiled Worker successfully
2023-03-12T23:38:10.441211Z Validating asset output directory
2023-03-12T23:38:11.337595Z Failed: an internal error occurred

This is my build config:

Screen Shot 2023-03-12 at 7 40 43 PM
amok commented 10 months ago

Any chances to get this fixed?

amok commented 10 months ago

The issue is related to #32 Deployment does not fail if this line is removed https://github.com/cloudflare/pages-plugins/blob/c9bdd1e8a10ad276958c399111a1e5293574af4f/packages/graphql/functions/index.ts#L39