Skip to content

Conversation

@piotrjoniec
Copy link

πŸ”— Linked issue

#3607

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves #3607

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel
Copy link

vercel bot commented Nov 10, 2025

@piotrjoniec is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 10, 2025

npm i https://pkg.pr.new/@nuxt/content@3608

commit: 79ce609

const config = event?.context?.nitro?.runtimeConfig
const url = new URL(event.context.cloudflare?.request?.url || 'http://localhost')
url.pathname = `/dump.${collection}.sql`
url.pathname = `${config?.app?.baseURL || '/'}dump.${collection}.sql`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url.pathname = `${config?.app?.baseURL || '/'}dump.${collection}.sql`
url.pathname = `/dump.${collection}.sql`

The code incorrectly includes baseURL in the public asset pathname, which will cause asset fetches to fail in Cloudflare deployments that have a non-root baseURL configured.

View Details

Analysis

Incorrect baseURL prefix in Cloudflare database handler causes asset fetch failures

What fails: database-handler.ts in Cloudflare preset incorrectly includes baseURL prefix when constructing asset path, causing ASSETS.fetch() to request dump files from wrong location

How to reproduce:

  1. Deploy Nuxt Content app to Cloudflare with baseURL: '/app/' configured
  2. Access any route that triggers database handler (e.g., collection queries)
  3. Handler attempts to fetch from /app/dump.collection.sql instead of /dump.collection.sql

Result: Returns 404 response as text instead of SQL dump data, breaking data loading for collections

Expected: Assets should be fetched from root path /dump.collection.sql where publicAssets are served by Cloudflare, regardless of baseURL setting per Nitro publicAssets documentation

Root cause: publicAssets are served from root path by Cloudflare Workers/Pages static asset serving, but handler incorrectly applies app.baseURL prefix to asset pathname construction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloudflare deployment completely fails when app.baseURL is set (dump SQL path mismatch)

1 participant