Skip to content

queries fail on D1 DB on cloudflare, but never locally #3683

@pcornelissen

Description

@pcornelissen

Environment

Operating system macOS 25.2.0 CPU Apple M3 Pro (12 cores)
Node.js version v25.2.1 nuxt/cli version 3.32.0 Package manager pnpm 10.28.0 Nuxt version 4.2.2 │
Nitro version 2.13.0 │
Builder vite 7.3.1 │
Config colorMode, compatibilityDate, css, devtools, eslint, feedme, fonts, hooks, modules, nitro, routeRules, site, sitemap, typescript │
Modules @nuxt/content 3.10.0, @nuxt/eslint 1.12.1, @nuxt/hints 1.0.0-alpha.5, @nuxt/image 2.0.0, @nuxt/ui 4.3.0, @nuxt/fonts 0.12.1, @nuxt/scripts 0.13.2, │
│ │ @nuxtjs/sitemap 7.5.0, nuxt-feedme 2.1.0

Version

v3.10.0

Reproduction

https://github.com/pcornelissen/faktenfackelWeb (Can't reproduce in a simple project)

https://last-commit-problem-faktenfackel.faktenfackel.workers.dev/faktenchecks/gesellschaft/arbeitsmarkt/krise-im-rentensystem

Description

I have created a branch deployment to show the problem: https://last-commit-problem-faktenfackel.faktenfackel.workers.dev/faktenchecks/gesellschaft/arbeitsmarkt/krise-im-rentensystem there you can see in the first paragrapth that most of the time the error appears ("Der Zuschuss zur Rentenkasse ist der größte Block im Bundeshaushalt. 2025 wird der Zuschuss zur Rentenkasse
Kein Link gefunden! ifo-zuschuss-rentenversicherung
betragen.
")
Sometimes (very infrequently) it is the correct result "Der Zuschuss zur Rentenkasse ist der größte Block im Bundeshaushalt. 2025 wird der Zuschuss zur Rentenkasse ein Drittel der Steuereinnahmen (Quelle) betragen."

The broken content is rendered using a component (app/components/content/Reference.vue) that looks up the link of the source using:

const { data: linkRaw }
  = await
  useAsyncData(
    `quellenlink-${props.code}`,
    () => {
      console.trace('quellenlinks', 'code', props.code)
      return queryCollection('quellenlinks').where('code', '=', props.code).first()
    })

The weird thing is that it works locally 100% of the time, there is no error message when deplyoyed on cloudflare. The query for that collection just yields an empty string (according to the console.trace in the code)
The content of the page itself is also coming fom the D1 DB, so the connection works.
The data is in the DB, I have confirmed that with the cloudflare UI and if ot wouldn't be there, it wouldn't work sometimes.

Similar query code is used all over the page and works fine. Is that a cloudflare problem, a configuration problem or a nuxt-content problem?

Is there something I can do to get more insights whats going wrong?

Additional context

No response

Logs

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