nitrojs / nitrojs/nitro

Bun preset doesn't work for TanStack Start `createFileRoute` $ API endpoints

Open
#3,808 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug tanstack v3
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment

Dynamic API endpoints created using createFileRoute in TanStack Start are not being registered when using the Bun preset. All API route requests return 404 errors instead of executing the defined handlers.

Reproduction
  1. Make a $ route:
Image

example:

import { createFileRoute } from '@tanstack/react-router'
import { reactStartHandler } from '@convex-dev/better-auth/react-start'

export const Route = createFileRoute('/api/auth/$')({
  server: {
    handlers: {
      GET: ({ request }) => {
        return reactStartHandler(request)
      },
      POST: ({ request }) => {
        return reactStartHandler(request)
      },
    },
  },
})
  1. Build using preset:
plugins.push(nitro({ preset: 'bun' }))
Describe the bug

All API route requests return 404 errors instead of executing the defined handlers.

Additional context
"nitro": "3.0.1-alpha.1",
bun --version
1.3.2
Logs

none

Image

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

Start with the reproduced createFileRoute('/api/auth/$') example and the Nitro configuration using preset: 'bun'. Build the application with Nitro 3.0.1-alpha.1 and Bun 1.3.2, then inspect why requests to the dynamic API endpoint return 404 instead of invoking the declared GET and POST handlers. Done means those handlers are registered and API requests no longer return 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.