Skip to content

staticFunctionMiddleware Unexpected token '<', "<!DOCTYPE "... is not valid JSON  #7630

Description

@aymericzip

Which project does this relate to?

Router

Describe the bug

When I add staticFunctionMiddleware to my server function, it throws an error after the build:

Unexpected token '<', "<!DOCTYPE "... is not valid JSON

The returned object is serializable as JSON.

I also tried JSON.parse(JSON.stringify(result)), but I get the same error.

Complete minimal reproducer

https://github.com/aymericzip/staticFunctionMiddleware_repro

Steps to Reproduce the Bug

bun install 
bun run build
cd ./apps/website-tanstack
uncomment middleware in `apps/website-tanstack/src/serverFunctions/docs.ts`
bun run build
bun run start 

navigate to /doc

I also included a demo for #7516
comment code in packages/@intlayer/design-system/src/providers/ReactQueryProvider.tsx

cd ../../
bun run build ## rebuild design system
cd ./apps/website-tanstack
bun run build

Expected behavior

Screenshots or Videos

Demo: https://drive.google.com/open?id=1gBbIZ2okGl099IfONT5lGjToc2TeMtBf&usp=drive_fs

Platform

"@tanstack/react-devtools": "0.10.5",
"@tanstack/react-query": "5.101.0",
"@tanstack/react-router": "1.170.15",
"@tanstack/react-router-ssr-query": "1.167.1",
"@tanstack/react-start": "1.168.25",
"@tanstack/react-virtual": "3.14.2",
"@tanstack/router-plugin": "1.168.18",
"bun": "1.3.14",

mac

Additional context

No response

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