Closed aligzl closed 2 weeks ago
What is displayed when your run npx nuxi info
?
What is displayed when your run
npx nuxi info
?
instaling "nitropack": "2.9.7" and adding
"overrides": {
"nitropack": "2.9.7"
}
to package.json solved my issue for now
✅ Nitro 2.10.1 is released with a (related) fix. Recreating lock file should solve the problem.
Hi Getting this error during deployment
Error: Failed to publish your Function. Got error: Uncaught Error: Missing Cloudflare DB binding (D1) at chunks/nitro/nitro.mjs:1:68337 in createError$1 at chunks/nitro/nitro.mjs:1:489144 in hubDatabase at chunks/nitro/nitro.mjs:1:500109
Could you please try with nuxthub/core 0.8.5?
Could you please try with nuxthub/core 0.8.5?
Still same error with fallowing
Error: Failed to publish your Function. Got error: Uncaught Error: Missing Cloudflare DB binding (D1)
at chunks/nitro/nitro.mjs:1:68337 in createError$1
at chunks/nitro/nitro.mjs:1:489180 in hubDatabase
at chunks/nitro/nitro.mjs:1:500032
------------------------------
- Operating System: Darwin
- Node Version: v21.7.3
- Nuxt Version: 3.14.0
- CLI Version: 3.15.0
- Nitro Version: 2.10.2
- Package Manager: pnpm@9.9.0
- Builder: -
- User Config: default
- Runtime Modules: @nuxthub/core@0.8.5, @nuxt/eslint@0.6.1, @nuxt/fonts@0.10.2, @nuxt/ui, @vueuse/nuxt@11.2.0, @nuxtjs/i18n@9.0.0, nuxt-security@2.0.0, nuxt-auth-utils@0.5.1
- Build Modules: -
------------------------------
How do you deploy your app @aligzl ?
How do you deploy your app @aligzl ?
trough github actions
Hi @atinux Have you managed to find the issue? as i cant baypass anymore within downgrading.
Do you mind inviting me to your project? Did you change anything in the bindings of your project on Cloudflare?
Do you mind inviting me to your project? Did you change anything in the bindings of your project on Cloudflare?
I have invited you to my project and i did not touch anything in the bindings
I found the issue @aligzl
You should not call hubDatabase()
or hubKV()
inside the server/utils/
without wrapping them into a function:
- export const todoDb = new todoService(hubDatabase())
+ export const todoDb = () => new todoService(hubDatabase())
You will need to update todoDb.findOneAndUpdate
to todoDb().findOneAndUpdate
for example.
This is because the bindings are available only when the request comes in, so inside the event handlers, before this, they are not ready, thus the error happening (I believe Cloudflare try to run the code before deploying it).
I found the issue @aligzl
You should not call
hubDatabase()
orhubKV()
inside theserver/utils/
without wrapping them into a function:- export const todoDb = new todoService(hubDatabase()) + export const todoDb = () => new todoService(hubDatabase())
You will need to update
todoDb.findOneAndUpdate
totodoDb().findOneAndUpdate
for example.This is because the bindings are available only when the request comes in, so inside the event handlers, before this, they are not ready, thus the error happening (I believe Cloudflare try to run the code before deploying it).
let me try, But it was working before
Thanks for your kind help
It was an issue if it was working before I believe, it was probably related to how the chunks were generated with Nitro.
It works as expected now i think it's a good point to add it to the docs to avoid this kind of mistakes or approaches
Thanks
Where do you think would be the best place?
Describe the bug Hi, i cant deploy my app as getting error about hubDatabase during the deployment
17:48:42.892 Error: Failed to publish your Function. Got error: Uncaught ReferenceError: Cannot access 'tc' before initialization at chunks/nitro/nitro.mjs:1:588600 in useRuntimeConfig at chunks/nitro/nitro.mjs:1:225944 in requireNuxtHubFeature at chunks/nitro/nitro.mjs:1:444655 in hubDatabase at chunks/nitro/nitro.mjs:1:458639
Steps to reproduce Steps to reproduce the behavior: Deplyment Logs