Skip to content

[9.5] optional catch all routes req.query.params behavior is different when deployed on vercel (works in dev, works in 9.4.4) #15579

Description

@vvo

Bug report

Describe the bug

Hi, just tried to upgrade from 9.4.4 to 9.5.0. I was previously using the experimental optionalCatchAll flag. On 9.5.0 my optional catch-all routes are working in dev mode (next dev) but no more working when deployed on Vercel.

The issue is that req.query.params value is different between Vercel and dev mode when using optional catch-all routes.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Given a project structure of:

- project
- api/
- api/organizations/
- api/organizations/[organizationId]
- api/organizations/[organizationId]/teams/
- api/organizations/[organizationId]/teams/[[...params]].js

When calling https://example.com/organizations/200/teams on vercel (9.5.0):

  • req.query.params value: [""]

When calling https://localhost/organizations/200/teams on next dev (9.5.0):

  • req.query.params value: undefined

When calling https://example.com/organizations/200/teams on vercel (9.4.4):

  • req.query.params value: undefined

When calling https://localhost/organizations/200/teams on next dev (9.4.4):

  • req.query.params value: undefined

Expected behavior

Both vercel and next dev should send the same value for req.query.params, maybe sticking to undefined or anything else that makes sense given current APIs.

System information

  • OS: macOS
  • Version of Next.js: 9.5.0
  • Version of Node.js: 12.8.3

Additional context

n/a

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions