nitrojs / nitrojs/nitro

In-server fetch to dev routes not working

Open
#4,080 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment

Nitro version: 2.13.1
Node version: 20.19.1

import { defineEventHandler } from 'h3';

export default defineNitroConfig({
  compatibilityDate: '2025-03-01',
  srcDir: 'server',
  devHandlers: [
    {
      route: '/devTest',
      handler: defineEventHandler((event) => {
        return 'dev test response';
      }),
    },
  ],
});

Reproduction

Minimal reproduction in stackblitz

  1. Define dev route in the nitro config.
  2. Verify that the route is working when called directly.
  3. Define normal route that calls the dev route -> Fails with error.
Describe the bug

The dev routes are not reachable from the normal routes. More info in the original issue I opened on nuxt repo.

Additional context

No response

Logs

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 nitro.config.ts setup and reproduce the behavior using the linked StackBlitz example, comparing direct requests to /devTest with requests made from a normal route. Trace how devHandlers are reached during in-server fetches; done means the normal route can reach /devTest as well as a direct request.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.