Skip to content

sql_dump.txt routes fail prerender with crawlLinks: true #3667

@onmax

Description

@onmax

Environment

  • @nuxt/content: 3.10.0
  • Preset: cloudflare-pages (non-static)

Describe the bug

When using nitro.prerender.crawlLinks: true, the /__nuxt_content/:collection/sql_dump.txt routes are discovered during prerendering and fail because the handler needs cloudflare bindings (ASSETS) that aren't available at build time.

Reproduction

https://stackblitz.com/edit/github-n1pcahgr

Or locally:

# nuxt.config.ts
nitro: { prerender: { routes: ['/'], crawlLinks: true } }

Run npm run build with NITRO_PRESET=cloudflare-pages.

Expected behavior

The sql_dump.txt routes should be excluded from prerendering since they're API routes that need runtime bindings.

Related

Suggested fix

Add prerender.ignore for the sql_dump.txt routes in the cloudflare preset:

// src/presets/cloudflare.ts setupNitro
nitroConfig.prerender ||= {}
nitroConfig.prerender.ignore ||= []
nitroConfig.prerender.ignore.push(/^\/__nuxt_content\/.*\/sql_dump\.txt/)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions