Skip to content

Routes that only export action fail with Prerender: Received a 400 status code from entry.server.tsx while prerendering the /path #12904

Closed
@remorses

Description

@remorses

I'm using React Router as a...

framework

Reproduction

https://stackblitz.com/edit/stackblitz-webcontainer-api-starter-54oaxcde?file=app%2Froutes%2Fapi%2Fpokemon.ts

Run pnpm build, react-router fails with [react-router] Prerender: Received a 400 status code from entry.server.tsxwhile prerendering the/api/pokemon/ path.

System Info

System:
    OS: macOS 15.2
    CPU: (10) arm64 Apple M2 Pro
    Memory: 103.44 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.0 - ~/.local/share/pnpm/node
    Yarn: 1.22.22 - ~/.local/share/pnpm/yarn
    npm: 10.9.2 - ~/.local/share/pnpm/npm
    pnpm: 9.14.4 - ~/.local/share/pnpm/pnpm
    bun: 1.2.1 - ~/.bun/bin/bun
  Browsers:
    Chrome: 132.0.6834.111
    Safari: 18.2
  npmPackages:
    @react-router/dev: ^7.0.0 => 7.1.3 
    @react-router/fs-routes: ^7.1.3 => 7.1.3 
    @react-router/node: ^7.0.0 => 7.1.3 
    @react-router/serve: ^7.0.0 => 7.1.3 
    react-router: ^7.1.3 => 7.1.3 
    vite: ^5.4.11 => 5.4.14

Used Package Manager

npm

Expected Behavior

Do not prerender resource routes

Actual Behavior

react-router tries to prerender a resource route without a loader

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions