nuxt-hub / core

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

Error after 0.8.x release #346

Closed aligzl closed 3 weeks ago

aligzl commented 3 weeks ago

Hi,

I cant run npm run dev or npx nuxthub deploy with remote option after update. Getting fallowing errors for each npm command. I cant continue to developement.

Note: I am not using drizzle

npx nuxthub deploy ERROR [POST] "https://admin.hub.nuxt.com/api/projects/{project-id}/database/preview/query": 400 Project not deployed with database storage on preview env - Project not deployed with database storage on preview env

ERROR [POST] "https://admin.hub.nuxt.com/api/projects/{project-id}/database/preview/query": 400 Project not deployed with database storage on preview env - Project not deployed with database storage on preview env

npm run dev ERROR No deployment found for preview, make sure to deploy the project using npx nuxthub deploy.

npm run dev without remote: true ERROR [worker reload] [worker init] Missing Cloudflare DB binding (D1)

at createError (node_modules/.pnpm/h3@1.13.0/node_modules/h3/dist/index.mjs:73:12) at hubDatabase (node_modules/.pnpm/@nuxthub+core@0.8.2_ioredis@5.4.1_magicast@0.3.5_rollup@4.24.0vite@5.4.10@types+node@22.8.1terser@5.36.0/node_modules/@nuxthub/core/dist/runtime/database/server/utils/database.js:22:9) at (server/utils/db.ts:13:1) at ModuleJob.run (node:internal/modules/esm/module_job:222:25) at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

atinux commented 3 weeks ago

Could you please try without the remote: true option but instead use npx nuxt dev --remote?

aligzl commented 3 weeks ago

npx nuxt dev --remote

still same result ERROR No deployment found for preview, make sure to deploy the project using npx nuxthub deploy.

aligzl commented 3 weeks ago

This issue is quite urgent to fix, I can’t continue to develop

atinux commented 3 weeks ago

You can revert to v0.7 in the meantime. I will have a look once back on computer

aligzl commented 3 weeks ago

I did but still same issue, I guess nuxthub has different approach on admin side as well.

26 Eki 2024 Cmt, saat 19:01 tarihinde Sébastien Chopin < @.***> şunu yazdı:

You can revert to v0.7 in the meantime. I will have a look once back on computer

— Reply to this email directly, view it on GitHub https://github.com/nuxt-hub/core/issues/346#issuecomment-2439632423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGF4S3OOL5JHABLKSIQSFZLZ5O4GLAVCNFSM6AAAAABQUXT6WKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZZGYZTENBSGM . You are receiving this because you authored the thread.Message ID: @.***>

atinux commented 3 weeks ago

Can you invite me to your GH repo?

maggie44 commented 3 weeks ago

I deleted my dev env database and recreated it to try and resolve the issue. Looks like it wasn't an issue my end if others are experiencing it now too.

Now I have recreated the DB Nuxt Hub doesn't seem to be picking up the new DB. Perhaps it uses UID instead of database name? How do I now add my new DB in place? I don't want to have to recreate the whole project because I would lose all my env vars.

Same for KV: Failed to publish your Function. Got error: No KV namespace found with ID

aligzl commented 3 weeks ago

Can you invite me to your GH repo?

i did

aligzl commented 3 weeks ago

I deleted my dev env database and recreated it to try and resolve the issue. Looks like it wasn't an issue my end if others are experiencing it now too.

Now I have recreated the DB Nuxt Hub doesn't seem to be picking up the new DB. Perhaps it uses UID instead of database name? How do I now add my new DB in place? I don't want to have to recreate the whole project because I would lose all my env vars.

same same, i have runing project in production, i dont wanna loose my db or env

atinux commented 3 weeks ago

You can open the project on Cloudflare (Cloudflare icon on the top right of the NuxtHub dashboard), the open the project settings on Cloudflare and select the database you want as binding (DB) then retry the latest deployment.

BTW could you try again, I updated the Dashboard API that may cause the remote to be preview instead of production by default on main branch

maggie44 commented 3 weeks ago

The original issue reported here is solved for me now.

Still struggling a bit with the new database migrations though:

npx nuxthub database migrations mark-all-applied
NuxtHub CLI                                                                                                             7:18:04 PM
ℹ No environment provided, defaulting to local.                                                                        7:18:04 PM
│
◇  Do you want to mark 1 migration as applied on http://localhost:3000?
│  Yes
✔ Marked 1 migration as applied on http://localhost:3000.
npm run dev        

> dev
> nuxi dev

Nuxt 3.13.2 with Nitro 2.9.7                                                                                            7:17:11 PM
                                                                                                                        7:17:11 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

ℹ Using local storage from .data/hub                                                                          nuxt:hub 7:17:12 PM
ℹ Using default Tailwind CSS file                                                                     nuxt:tailwindcss 7:17:13 PM
  ➜ DevTools: press Shift + Option + D in the browser (v1.6.0)                                                          7:17:13 PM

ℹ Nuxt Icon server bundle mode is set to local                                                                         7:17:14 PM
ℹ Running with compatibility version 4                                                                                 7:17:14 PM
ℹ Tailwind Viewer: http://localhost:3000/_tailwind/                                                   nuxt:tailwindcss 7:17:14 PM
ℹ Nuxt Icon client bundle consist of 13 icons with 5.53KB(uncompressed) in size                                        7:17:14 PM
✔ Vite client built in 53ms                                                                                            7:17:15 PM
✔ Vite server built in 669ms                                                                                           7:17:16 PM
✔ Nuxt Nitro server built in 2395 ms                                                                             nitro 7:17:22 PM
✔ Database migration ./server/database/migrations/0000_parallel_hercules.sql applied

 ERROR  Database migrations failed D1_ERROR: table cf_keys already exists at offset 13: SQLITE_ERROR

  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at SQLiteD1Session.batch (node_modules/.pnpm/drizzle-orm@0.35.3_@cloudflare+workers-types@4.20241022.0_@libsql+client-wasm@0.14.0/node_modules/src/d1/session.ts:82:24)
  at migrate (node_modules/.pnpm/drizzle-orm@0.35.3_@cloudflare+workers-types@4.20241022.0_@libsql+client-wasm@0.14.0/node_modules/src/d1/migrator.ts:47:3)
  at <anonymous> (server/plugins/migrations.ts:8:1)
  at async Promise.all (index 0)
  at <anonymous> (node_modules/.pnpm/@nuxthub+core@0.8.2_ioredis@5.4.1_magicast@0.3.5_rollup@4.24.0_vite@5.4.8_@types+node@22.7.5_terser@5.34.1_/node_modules/@nuxthub/core/dist/runtime/database/server/plugins/migrations.dev.js:15:5)
  at async Promise.all (index 0)
  at <anonymous> (node_modules/.pnpm/@nuxthub+core@0.8.2_ioredis@5.4.1_magicast@0.3.5_rollup@4.24.0_vite@5.4.8_@types+node@22.7.5_terser@5.34.1_/node_modules/@nuxthub/core/dist/runtime/ready.dev.js:5:3)
aligzl commented 3 weeks ago

mine works now with remote:true config.

RolandoHidalgo commented 3 weeks ago

I was facing the same issue after update to 0.8.x, i was using this workaround:

nuxi dev --remote production.

Now everything works fine using normal: nuxi dev --remote.

I also update to v0.8.2

aligzl commented 3 weeks ago

@RolandoHidalgo @atinux made some changes after this issue

RolandoHidalgo commented 3 weeks ago

@RolandoHidalgo @atinux made some changes after this issue

I know, my comment was intended to confirm that those changes worked. and it doesn't trying to run on preview as default on main branch.

atinux commented 3 weeks ago

I am glad to know that the issue is now resolved.

The original issue reported here is solved for me now.

Still struggling a bit with the new database migrations though:

npx nuxthub database migrations mark-all-applied
NuxtHub CLI                                                                                                             7:18:04 PM
ℹ No environment provided, defaulting to local.                                                                        7:18:04 PM
│
◇  Do you want to mark 1 migration as applied on http://localhost:3000?
│  Yes
✔ Marked 1 migration as applied on http://localhost:3000.
npm run dev        

> dev
> nuxi dev

Nuxt 3.13.2 with Nitro 2.9.7                                                                                            7:17:11 PM
                                                                                                                        7:17:11 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

ℹ Using local storage from .data/hub                                                                          nuxt:hub 7:17:12 PM
ℹ Using default Tailwind CSS file                                                                     nuxt:tailwindcss 7:17:13 PM
  ➜ DevTools: press Shift + Option + D in the browser (v1.6.0)                                                          7:17:13 PM

ℹ Nuxt Icon server bundle mode is set to local                                                                         7:17:14 PM
ℹ Running with compatibility version 4                                                                                 7:17:14 PM
ℹ Tailwind Viewer: http://localhost:3000/_tailwind/                                                   nuxt:tailwindcss 7:17:14 PM
ℹ Nuxt Icon client bundle consist of 13 icons with 5.53KB(uncompressed) in size                                        7:17:14 PM
✔ Vite client built in 53ms                                                                                            7:17:15 PM
✔ Vite server built in 669ms                                                                                           7:17:16 PM
✔ Nuxt Nitro server built in 2395 ms                                                                             nitro 7:17:22 PM
✔ Database migration ./server/database/migrations/0000_parallel_hercules.sql applied

 ERROR  Database migrations failed D1_ERROR: table cf_keys already exists at offset 13: SQLITE_ERROR

  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at SQLiteD1Session.batch (node_modules/.pnpm/drizzle-orm@0.35.3_@cloudflare+workers-types@4.20241022.0_@libsql+client-wasm@0.14.0/node_modules/src/d1/session.ts:82:24)
  at migrate (node_modules/.pnpm/drizzle-orm@0.35.3_@cloudflare+workers-types@4.20241022.0_@libsql+client-wasm@0.14.0/node_modules/src/d1/migrator.ts:47:3)
  at <anonymous> (server/plugins/migrations.ts:8:1)
  at async Promise.all (index 0)
  at <anonymous> (node_modules/.pnpm/@nuxthub+core@0.8.2_ioredis@5.4.1_magicast@0.3.5_rollup@4.24.0_vite@5.4.8_@types+node@22.7.5_terser@5.34.1_/node_modules/@nuxthub/core/dist/runtime/database/server/plugins/migrations.dev.js:15:5)
  at async Promise.all (index 0)
  at <anonymous> (node_modules/.pnpm/@nuxthub+core@0.8.2_ioredis@5.4.1_magicast@0.3.5_rollup@4.24.0_vite@5.4.8_@types+node@22.7.5_terser@5.34.1_/node_modules/@nuxthub/core/dist/runtime/ready.dev.js:5:3)

Feel free to open another issue on this one with the content of your migration file to investigate 🙏