nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
992 stars 57 forks source link

CloudFlare build failed #186

Closed Kamsou closed 4 months ago

Kamsou commented 4 months ago

Describe the bug I initiated a Nuxt Hub project. I haven't added any features. I just pushed it on my Github. I created my CloudFlare account. I linked the projects. But when deploying on CloudFlare I get errors that I don't understand.

Steps to reproduce

Settings on CloudFlare

Build command:
npm run build
Build output directory:
/dist

Errors Logs on CloudFlare

2024-06-27T08:12:24.084874Z Cloning repository...
2024-06-27T08:12:24.71599Z  From https://github.com/Kamsou/my-todo-of-the-day
2024-06-27T08:12:24.716455Z  * branch            9317a6362c8b3d435294c8c1f02f15cfc954530f -> FETCH_HEAD
2024-06-27T08:12:24.716551Z 
2024-06-27T08:12:24.750032Z HEAD is now at 9317a63 yarn
2024-06-27T08:12:24.750447Z 
2024-06-27T08:12:24.833832Z 
2024-06-27T08:12:24.834318Z Using v2 root directory strategy
2024-06-27T08:12:24.859785Z Success: Finished cloning repository files
2024-06-27T08:12:26.512626Z Checking for configuration in a wrangler.toml configuration file (BETA)
2024-06-27T08:12:26.513264Z 
2024-06-27T08:12:26.61417Z  No wrangler.toml file found. Continuing.
2024-06-27T08:12:26.762926Z Detected the following tools from environment: yarn@3.6.3, nodejs@18.17.1
2024-06-27T08:12:26.763687Z Installing project dependencies: yarn
2024-06-27T08:12:27.359276Z ➀ YN0070: Migrating from Yarn 1; automatically enabling the compatibility node-modules linker πŸ‘
2024-06-27T08:12:27.359867Z 
2024-06-27T08:12:27.467892Z ➀ YN0000: β”Œ Resolution step
2024-06-27T08:12:28.78427Z  ➀ YN0032: β”‚ fsevents@npm:2.3.3: Implicit dependencies on node-gyp are discouraged
2024-06-27T08:12:30.483326Z ➀ YN0032: β”‚ @parcel/watcher@npm:2.4.1: Implicit dependencies on node-gyp are discouraged
2024-06-27T08:12:30.97336Z  ➀ YN0061: β”‚ glob@npm:7.2.3 is deprecated: Glob versions prior to v9 are no longer supported
2024-06-27T08:12:30.973592Z ➀ YN0061: β”‚ glob@npm:8.1.0 is deprecated: Glob versions prior to v9 are no longer supported
2024-06-27T08:12:31.322675Z ➀ YN0032: β”‚ node-addon-api@npm:7.1.0: Implicit dependencies on node-gyp are discouraged
2024-06-27T08:12:31.410945Z ➀ YN0061: β”‚ npmlog@npm:5.0.1 is deprecated: This package is no longer supported.
2024-06-27T08:12:31.437143Z ➀ YN0061: β”‚ inflight@npm:1.0.6 is deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
2024-06-27T08:12:31.506638Z ➀ YN0061: β”‚ rimraf@npm:3.0.2 is deprecated: Rimraf versions prior to v4 are no longer supported
2024-06-27T08:12:31.625433Z ➀ YN0061: β”‚ are-we-there-yet@npm:2.0.0 is deprecated: This package is no longer supported.
2024-06-27T08:12:31.664818Z ➀ YN0061: β”‚ gauge@npm:3.0.2 is deprecated: This package is no longer supported.
2024-06-27T08:12:34.828365Z ➀ YN0061: β”‚ rollup-plugin-inject@npm:3.0.2 is deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
2024-06-27T08:12:34.876042Z ➀ YN0061: β”‚ sourcemap-codec@npm:1.4.8 is deprecated: Please use @jridgewell/sourcemap-codec instead
2024-06-27T08:12:38.664451Z ➀ YN0002: β”‚ @netlify/serverless-functions-api@npm:1.18.4 doesn't provide @opentelemetry/api (p2a898), requested by @opentelemetry/core
2024-06-27T08:12:38.664733Z ➀ YN0002: β”‚ @netlify/serverless-functions-api@npm:1.18.4 doesn't provide @opentelemetry/api (p418a4), requested by @opentelemetry/resources
2024-06-27T08:12:38.664865Z ➀ YN0002: β”‚ @netlify/serverless-functions-api@npm:1.18.4 doesn't provide @opentelemetry/api (p5dc1c), requested by @opentelemetry/otlp-transformer
2024-06-27T08:12:38.664975Z ➀ YN0002: β”‚ @netlify/serverless-functions-api@npm:1.18.4 doesn't provide @opentelemetry/api (p0acee), requested by @opentelemetry/sdk-trace-node
2024-06-27T08:12:38.665117Z ➀ YN0002: β”‚ @netlify/serverless-functions-api@npm:1.18.4 doesn't provide @opentelemetry/api (p7ca4a), requested by @opentelemetry/sdk-node
2024-06-27T08:12:38.665226Z ➀ YN0002: β”‚ @nuxt/eslint@npm:0.3.13 [a4e71] doesn't provide vite (p90c66), requested by @nuxt/devtools-kit
2024-06-27T08:12:38.665353Z ➀ YN0002: β”‚ @nuxthub/core@npm:0.6.17 doesn't provide vite (p64c56), requested by @nuxt/devtools-kit
2024-06-27T08:12:38.665461Z ➀ YN0002: β”‚ @vue/devtools-core@npm:7.3.3 doesn't provide vite (p5fb74), requested by vite-hot-client
2024-06-27T08:12:38.665561Z ➀ YN0002: β”‚ nuxt@npm:3.12.2 [a4e71] doesn't provide vite (p6835a), requested by @nuxt/devtools
2024-06-27T08:12:38.665692Z ➀ YN0060: β”‚ nuxthub-starter@workspace:. provides eslint (pcded5) with version 9.5.0, which doesn't satisfy what @nuxt/eslint-config and some of its descendants request
2024-06-27T08:12:38.665864Z ➀ YN0002: β”‚ nuxthub-starter@workspace:. doesn't provide typescript (pb359c), requested by vue-tsc
2024-06-27T08:12:38.665968Z ➀ YN0000: β”‚ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
2024-06-27T08:12:38.672605Z ➀ YN0000: β”” Completed in 11s 205ms
2024-06-27T08:12:38.724502Z ➀ YN0000: β”Œ Post-resolution validation
2024-06-27T08:12:38.724744Z ➀ YN0028: β”‚ The lockfile would have been modified by this install, which is explicitly forbidden.
2024-06-27T08:12:38.72482Z  ➀ YN0000: β”” Completed
2024-06-27T08:12:38.72488Z  ➀ YN0000: Failed with errors in 11s 262ms
2024-06-27T08:12:38.831015Z Error: Exit with error code: 1
2024-06-27T08:12:38.831398Z     at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)
2024-06-27T08:12:38.831502Z     at Object.onceWrapper (node:events:652:26)
2024-06-27T08:12:38.831688Z     at ChildProcess.emit (node:events:537:28)
2024-06-27T08:12:38.831772Z     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2024-06-27T08:12:38.839843Z Failed: build command exited with code: 1
2024-06-27T08:12:39.664675Z Failed: error occurred while running build command

Expected behavior Deploy done !

atinux commented 4 months ago

Hello @Kamsou

Could you try to install the dependencies with pnpm and commit the pnpm-lock.json file and see if the deploy works?

Kamsou commented 4 months ago

Thanks @Atinux , the deployment works now!

But when i visit my app, i have an 500 Error. Its a problem with wrangler ?

β–² [WARNING] Non-relative path "#internal/nitro/routes/openapi" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) [tsconfig.json]

    .nuxt/tsconfig.json:87:8:
      87 β”‚         "#internal/nitro/routes/openapi"
         β•΅         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[wrangler:inf] Ready on http://localhost:8788
β–² [WARNING] Non-relative path "#internal/nitro/routes/openapi" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) [tsconfig.json]

    .nuxt/tsconfig.json:87:8:
      87 β”‚         "#internal/nitro/routes/openapi"
         β•΅         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

βŽ” Starting local server...
✨ Parsed 0 valid redirect rules.
✨ Parsed 3 valid header rules.
[wrangler:inf] GET / 500 Internal Server Error 
atinux commented 4 months ago

What command did you run?

Kamsou commented 4 months ago

What command did you run?

first pnpm run build then, pnpm run preview then, npx wrangler pages dev dist/

atinux commented 4 months ago

We have an issue to preview locally at the moment, but the deployment should work with no issue actually.

Kamsou commented 4 months ago

The deployment works, but when i check website, i have an error 500 : https://b7bb5547.my-todo-of-the-day.pages.dev/

(if you want to see my deployment logs : my-todo-of-the-day.b7bb5547-08a2-4e68-aed3-eeebd1333d8e.log )

atinux commented 4 months ago

Sorry about this @Kamsou

I just tried now and I can see the 500 error in development as it is currently related to the fact that we don't generate the wrangler.toml at the moment (see #113 for ongoing progress).

I tried to deploy in production and seems to work with no issue.

CleanShot 2024-06-28 at 13 46 34@2x CleanShot 2024-06-28 at 13 46 39@2x

Did you deploy using the NuxtHub Admin or the NuxtHub CLI?

Kamsou commented 4 months ago

No problem. For deploy, I went to Cloudflare (by Nuxhub Admin link) and imported my github project. And it launched the deployment from there. I didn't do anything else.

For info:

Capture d’écran 2024-06-28 aΜ€ 14 14 50 Capture d’écran 2024-06-28 aΜ€ 14 16 49
atinux commented 4 months ago

For deploy, I went to Cloudflare (by Nuxhub Admin link) and imported my github project. And it launched the deployment from there. I didn't do anything else.

The main issue of this is you need to go through NuxtHub Admin for the deployment to make sure that we spawn all the necessary resources (R2, KV, D1).

Could you please remove the project on Cloudflare UI?

Then import the GitHub repository from the NuxtHub admin please? πŸ™

Kamsou commented 4 months ago

That was it, its works now ! I didn't do the installation in the right order πŸ₯Ή (sorry about that) Thanks @Atinux 🀝