Deploy Nuxt Content to Cloudflare Pages

Hey all! I have a really hard time to deploy an instance of Nuxt Content to Cloudflare Page. The deployment goes well up to the point where it errors when deploying to Cloudflare Global Network:
11:04:45.789 ✨ Compiled Worker successfully
11:04:46.968 Found _routes.json in output directory. Uploading.
11:04:46.980 Validating asset output directory
11:04:49.981 Deploying your site to Cloudflare's global network...
11:04:52.610 Parsed 6 valid header rules.
11:04:53.871 Uploading... (118/121)
11:04:54.326 Uploading... (119/121)
11:04:54.342 Uploading... (120/121)
11:04:54.402 Uploading... (121/121)
11:04:54.403 ✨ Success! Uploaded 3 files (118 already uploaded) (0.84 sec)
11:04:54.403
11:04:54.652 ✨ Upload complete!
11:04:57.741 Success: Assets published!
11:05:00.673 Error: Failed to publish your Function. Got error: Uncaught TypeError: Class extends value #<Object> is not a constructor or null at chunks/nitro/nitro.mjs:1:727062
11:04:45.789 ✨ Compiled Worker successfully
11:04:46.968 Found _routes.json in output directory. Uploading.
11:04:46.980 Validating asset output directory
11:04:49.981 Deploying your site to Cloudflare's global network...
11:04:52.610 Parsed 6 valid header rules.
11:04:53.871 Uploading... (118/121)
11:04:54.326 Uploading... (119/121)
11:04:54.342 Uploading... (120/121)
11:04:54.402 Uploading... (121/121)
11:04:54.403 ✨ Success! Uploaded 3 files (118 already uploaded) (0.84 sec)
11:04:54.403
11:04:54.652 ✨ Upload complete!
11:04:57.741 Success: Assets published!
11:05:00.673 Error: Failed to publish your Function. Got error: Uncaught TypeError: Class extends value #<Object> is not a constructor or null at chunks/nitro/nitro.mjs:1:727062
I really could use some help here if possible. Thank you!
4 Replies
kapa.ai
kapa.ai2w ago
Hi @ParadoxLector. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, I can offer some guidance on deploying Nuxt Content to Cloudflare Pages. The error you're encountering suggests there might be an issue with the compatibility between your Nuxt Content setup and Cloudflare Pages. Here are some steps you can try to resolve this: 1. Use the correct preset: Make sure you're using the cloudflare_pages preset when building your app. You can do this by adding the following to your nuxt.config.ts file:
export default defineNuxtConfig({
nitro: {
preset: 'cloudflare_pages',
},
});

export default defineNuxtConfig({
nitro: {
preset: 'cloudflare_pages',
},
});

Alternatively, you can use the --preset option when building:
nuxi build --preset=cloudflare_pages

nuxi build --preset=cloudflare_pages

2. Set up a D1 database: Nuxt Content requires a D1 database to be connected to the app when deploying to Cloudflare Pages. Create a new D1 database in your Cloudflare dashboard and connect it to your project using the binding name DB (which is the default name used by the module). 3. Check your database configuration: If you're using a custom database configuration, make sure it's correctly set up in your nuxt.config.ts file. 4. Verify compatibility: Ensure that all the modules and libraries you're using are compatible with Cloudflare Pages, which runs on edge functions. Some Node.js-specific libraries might not work in this environment. 5. Update to the latest versions: Make sure you're using the latest versions of Nuxt, Nuxt Content, and other related packages, as newer versions might have fixes for Cloudflare Pages deployment issues. If you're still encountering issues after trying these steps, you might want to check the Nuxt Content documentation for Cloudflare Pages deployment for any additional troubleshooting steps or known issues. Remember that deploying to Cloudflare Pages with Nuxt Content is supported, but it requires some specific configuration. If you continue to face problems, you might want to create a minimal reproduction of your issue and seek help from the Nuxt community or Cloudflare support. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@446488252854304776> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
ParadoxLector
ParadoxLectorOP2w ago
A D1 database (which is empty) is already setup and connected to the app. The preset for nitro is setup to "cloudflare_pages".
No description
ParadoxLector
ParadoxLectorOP2w ago
It appears the culprit is "nuxt-mail" module. After disable it, the deployment is 100% correct.

Did you find this page helpful?