Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong route handler used/RouteParams lost #26903

Closed
max06 opened this issue Apr 23, 2024 · 8 comments
Closed

Wrong route handler used/RouteParams lost #26903

max06 opened this issue Apr 23, 2024 · 8 comments

Comments

@max06
Copy link

max06 commented Apr 23, 2024

Environment

  • Operating System: Linux
  • Node Version: v20.11.0
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: bun@1.1.3
  • Builder: -
  • User Config: devtools, extends, modules, nitro, tailwindcss, ui
  • Runtime Modules: @nuxt/ui, @nuxtjs/color-mode, @nuxtjs/tailwindcss, @pinia/nuxt@^0.5.1, nuxt-monaco-editor@^1.2.7, @nuxt/test-utils/module@^3.12.0
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-eldm7g?file=README.md

Describe the bug

Having following route configuration:

    '/api/:alpha/:omega': {
      'get': Simplify<Serialize<Awaited<ReturnType<typeof import('../../server/api/[alpha]/[omega]/index.get').default>>>>
      'post': Simplify<Serialize<Awaited<ReturnType<typeof import('../../server/api/[alpha]/[omega]/index.post').default>>>>
    }
    '/api/:alpha/delta': {
      'post': Simplify<Serialize<Awaited<ReturnType<typeof import('../../server/api/[alpha]/delta/index.post').default>>>>
    }

I would expect a get-request to end up on the only matching get handler (:omega), with all the dynamic route parameters. Instead, the value for :omega is lost.

Additional context

UseCase: We have handlers for standard crud-operations on a generic endpoint (/api/[resourceType]/index.get.ts and so on). Some of these resourceTypes require special handling...

Logs

No response

Copy link

stackblitz bot commented Apr 23, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@manniL
Copy link
Member

manniL commented Apr 23, 2024

Duplicate of #22488

@manniL manniL marked this as a duplicate of #22488 Apr 23, 2024
@manniL manniL closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2024
@max06
Copy link
Author

max06 commented Apr 23, 2024

@manniL Uhm... care to explain how it is related?

@manniL manniL reopened this Apr 23, 2024
@manniL
Copy link
Member

manniL commented Apr 23, 2024

Sorry, my bad 🙈 Was meant to be in a different tab!

@manniL
Copy link
Member

manniL commented Apr 23, 2024

Can you kindly explain what the issue is here?

/api/a/o returns You've reached omega get, params { alpha: 'a', omega: 'o' } as expected

@max06
Copy link
Author

max06 commented Apr 23, 2024

happens 😂

Call /api/alpha/delta now - you'll end up in the omega-handler with only the alpha-param.

@manniL
Copy link
Member

manniL commented Apr 23, 2024

Opened upstream in unjs/nitro#2389

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2024
@danielroe
Copy link
Member

Let's track there 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants