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

API Route resolution conflict #3951

Open
timcosta opened this issue Apr 6, 2025 · 0 comments
Open

API Route resolution conflict #3951

timcosta opened this issue Apr 6, 2025 · 0 comments

Comments

@timcosta
Copy link

timcosta commented Apr 6, 2025

Which project does this relate to?

Start

Describe the bug

API Route precedence isn't working correctly when using two files in a directory such as

  • resource/$resourceId.ts - implements a GET method
  • resource/batch.ts - implements a POST method that takes a payload with a list of resource ids to fetch in bulk.

When you call POST /resource/batch you get back a 405 method not allowed error instead of the expected 200.

Your Example Website or App

None, discussed in discord

Steps to Reproduce the Bug or Issue

  1. Add route using createAPIFileRoute at /resource/$resourceId.ts with a GET handler.
  2. Add route using createAPIFileRoute at /resource/batch.ts with a POST handler.
  3. Call POST /resource/batch and get back a 405.

Expected behavior

I should get back a 200 because POST /resource/batch exactly matches a defined route which should take precedence over a parameterized route.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome and curl
  • Version: v133

Additional context

I'm submitting this bug report after a conversation with Manuel in the Discord #start channel today, where he helped me figure out why i was getting a 405 method not allowed when calling an endpoint that was defined.

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

2 participants