nuxt / nuxt/content

"content not found" on direct page refresh/navigation in production

Open
#3,534 24 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.7k
Forks
746
Avg merge
1d 16h
Merged PRs (30d)
3

Description

Environment
  • Operating system : macos
  • @nuxt/content: ^3.6.3
  • nuxt ^4.0.3
  • Node 24

In a Nuxt 4 project utilizing @nuxt/content, I am encountering an issue where content-rendered pages display "content not found" when directly navigating to the URL or refreshing the page with F5 in a production environment. The same pages load and render correctly when navigated via a <NuxtLink> from another page on the same site.

This issue is specific to production builds and is not reproducible in the local development environment. I am using @nuxt/content version ^3.6.3 and nuxt version ^4.0.3.

Version

v3

Reproduction

Reproducible Steps

  1. Build the Nuxt project for production (npm run build).

  2. Start the production server (npm run prod).

  3. Navigate to a content-rendered page via an internal . The content loads correctly.

  4. Perform a hard refresh (F5) on the same page. The page briefly shows the content before displaying a "content not found" message.

  5. Open a new browser tab and paste the exact URL of the content page. The page loads with "content not found" immediately.

Description
  • The problem appears to be related to Server-Side Rendering (SSR) and how the client-side hydration process handles API requests for content. The initial server-rendered HTML seems to contain the content, but the subsequent client-side fetch fails.

  • The API endpoint /api/_content returns a 404 error on page refresh or direct navigation.

  • This behavior has also been reported in related GitHub discussions, such as nuxt/content#2378. But there has not been much discussion around this in long time and it has been open since about 2 years now so wondering if this issue still in discussion and planning to fix this. Hence creating this new issue.

Additional context

Adding reference to old GitHub issue: https://github.com/nuxt/content/issues/2378

Normal navigation works fine, but when I do a hard refresh (cmd+shift+r), then for a fraction of a second I see the content, then I see the message content not found. I am seeing this issue in production only, but unable to recreate it in the local dev environment.

Any workaround or suggestion would be really helpful.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the production build with Nuxt 4.0.3 and @nuxt/content 3.6.3, comparing navigation through a NuxtLink with direct refresh or URL access. Start by inspecting the failing /api/_content request and the SSR/client hydration sequence. Done means direct navigation and hard refresh no longer return 404 or replace rendered content with “content not found”.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
api, backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.