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

Cannot Access Database in Nuxthub Admin - Missing Env Variables #294

Closed saurluca closed 1 month ago

saurluca commented 1 month ago

Describe the bug I set the database flag in my nuxt conifg to true, but I can not access it in the nuxthub admin dashboard do to the following error:

I set the NUXT_HUB_PROJECT_KEY and NUXT_HUB_PROJECT_SECRET_KEY in my local .env and in the nuxthub admin dashboard.

Logs

Error: Missing NUXT_HUB_PROJECT_SECRET_KEY environment variable or NUXT_HUB_PROJECT_KEY environment variable
    at window.drizzle (https://admin.hub.nuxt.com/_nuxt/E8F0nEat.js:34:300)
    at async o (https://admin.hub.nuxt.com/_nuxt/_dpJR7ZA.js:13439:6850)
    at async https://admin.hub.nuxt.com/_nuxt/_dpJR7ZA.js:13439:7022
    at async Promise.all (index 0)
    at async Tot (https://admin.hub.nuxt.com/_nuxt/_dpJR7ZA.js:13379:1111)
    at async Pot (https://admin.hub.nuxt.com/_nuxt/_dpJR7ZA.js:13439:7004)
    {
  "drizzle-version": "2.0.1",
  "drizzle-global": {
    "state": {
      "showCounts": false,
      "flatSchemas": false
    },
    "version": 0
  },
  "drizzle-playground": {
    "state": {
      "currentFile": "sql",
      "drizzleValue": null,
      "sqlValue": null,
      "showRecordsAsJson": false,
      "drizzleResult": "{\"json\":null}",
      "sqlResult": "{\"json\":null}"
    },
    "version": 0
  }
}
atinux commented 1 month ago

You should not have to specify them normally if you deploy using nuxthub deploy or using the admin.

Can you try with one of our templates?

saurluca commented 1 month ago

I tried it with your nuxt-hub-start and I get the same error.

The cloned repo: https://github.com/saurluca/nuxt-hub-starter

atinux commented 1 month ago

Could you please upgrade to https://github.com/nuxt-hub/core/releases/tag/v0.7.20 and test again? 🙏

saurluca commented 1 month ago

It works! Thank you very much : )

atinux commented 1 month ago

It seems that Cloudflare has a regression with process.env and their latest nodejs_compat flag, will work with them to see what they can do.

Thank you for reporting the issue <3

LeonardoRick commented 1 month ago

Is there any specific issue on their side where we can track this problem?

RihanArfan commented 1 month ago

@LeonardoRick I spoke with some Cloudflare employees today about it and they're still working on it. I'm not sure if there's an incident on their status page about it. As workaround, you can set hub.bindings.compatibilityDate to 2024-09-22 for now.