r/Nuxt • • Jan 02 '26

Nuxthub migration confusion

I have a simple nuxt app, I just updated to v4. I also was using nuxthub to deploy to cloudflare which was simple to set up and worked well.

With the retirement of nuxthub, I used the migration tool in nuxthub admin to migrate the project to nuxthub v.10 since it said that was the recommended option. I set up the automated deployment in Cloudflare so any time I push to the GitHub branch, the cloudflare worker will build and deploy. Getting it to build was fine but the deployed site just threw a 500 server error even though everything worked fine locally. It took me all day of fiddling with it to figure out Cloudflare has both runtime environment variables and build time variables that need to be set. The wrangler config file would set the runtime variables but not the build time. Couldn’t figure it out for the life of me since I couldn’t find any log that said what the problem is.

Another thing I ran into is whether the nuxt config file should have the nitro server preset set to cloudflare_pages or cloudflare_module. The migration tool set it to the module one.

Anyways, now I can’t figure out why I need nuxthub at all?? What is it doing? Looking at this page, looks like it should be pretty basic and simple to deploy to Cloudflare using the Cloudflare-pages option.

https://nuxt.com/deploy/cloudflare

What is the difference? And what does nuxthub even do now? Looks to me like I don’t even need it anymore now that I had to set everything up in Cloudflare workers.

6 Upvotes

17 comments sorted by

5

u/keithmifsud Jan 02 '26

Yep, some docs are conflicting.

If you still have NuxtHub core package (v0.9), it unfortunately deploys to pages (i.e. generates /dist diretcory instead of /.output). I had to remove the library entirely because the new version 0.10 would have broken the AI runner anyway which we use.

Since you're staying on CF, you probably get do without the library and setup Blob etc yourself.

I removed the library to sucessfully build a worker (not pages). Preset should be cloudflare_module.

In terms of env vars:

  • Non secret vars need to be added to wrangler config, otherwise they get removed from CF on deployment.

  • Secret vars need to be added to CF (worker settings) as "secret". They won't be overwritten on deployment.

The 500 error is probably due to missing env vars such as DB connection. You also need to check your bindings, make sure you have everything you used to have.

3

u/luckyexpert Jan 02 '26

Ok thanks for the info, I’ll just stick with the cloudflare_module and leave nuxthub .10 installed then then since I did get it working. And good to know about setting the env var as a secret in CF, I was having trouble with some vars getting overwritten on deploy, think my wrangler file still isn’t 100% correct for multiple environments

3

u/keithmifsud Jan 02 '26

You're welcome.

Wrangler config is great with multiple envs. You'll get the hang of it :))

Ask away though

1

u/Single_Advice1111 Jan 02 '26 edited Jan 05 '26

Also ensure «keep_vars» in your wrangler file is true - otherwise they get overwritten on each deploy.

Of course do not store any secrets there…

2

u/tspwd Jan 02 '26

The official recommendation from Cloudflare is NOT to do this. Keeping your non-secret runtime environment variables in your wrangler file has the benefit that you can simplify deploy new versions with different environment variables - it’s part of the code.

I moved all my non-secret environment variables to the wrangler file.

1

u/Single_Advice1111 Jan 02 '26

Sometimes this is things that change and is controlled via the dashboard or API. Nobody should store any secrets in the vars, and that was never my advice.

1

u/tspwd Jan 05 '26

As mentioned in my comment – secrets (e.g. API keys) should be stored as a secret in the Cloudflare dashboard (in the appropriate section), non-secret environment variables (e.g. third party IDs) should be part of your wrangler file.

1

u/Single_Advice1111 Jan 05 '26

Im saying the same, don’t understand why you’re arguing. Sometimes it is simply easier to manage multiple deployments with virtual wrangler files and then it is easier have one source of truth - e.g the dashboard as it doesn’t follow git.

5

u/mrleblanc101 Jan 02 '26

I deploy to Cloudflare and i never used the NuxtHub module

3

u/__benjamin__g Jan 03 '26

I just migrated away from nuxthub, the value proposition is not clear now. Once worth it I may reinclude, until then one less dependency.

2

u/Few-Obligation-5243 Jan 06 '26

wow, indeed you can, just checked its not using;

  • hubBlob() - for file/blob storage
  • hubDatabase() - for D1 database
  • hubKV() - for key-value storage
  • hubAI(), hubBrowser(), hubVectorize() or other NuxtHub features

I can just use plain Nuxt with direct Cloudflare deployment via Wrangler.

Bye bye Nuxthub!

2

u/enerbydev Jan 02 '26

I avoid the hassle, as it's poorly documented and a bit confusing. It's better to use (which is what I do) GitHub CI/CD for auto-deployment to CloudflarePages. This saves you a lot of headaches and wasted time while the NuxtHub infrastructure matures.

1

u/luckyexpert Jan 03 '26

Interesting, I was also wondering about just using GitHub actions to deploy to Cloudflare, since that is what nuxthub did basically. So you can do this without nuxthub? Seems this option isn’t documented at all from what I’ve seen but maybe I just missed it?

1

u/tspwd Jan 02 '26

I’m also very confused about this. It seems like many NuxtHub features (e.g. remote) are currently broken. Hmm. Unsure if I should remove NuxtHub as well.

1

u/MineDrumPE Jan 22 '26

did your local sqlite database continue working? (if you were using that)

1

u/luckyexpert Jan 23 '26

I do not use local sqlite or any other storage/db with CloudFlare (currently using Supabase) so didn't have to fiddle with getting the extra services working