Replies: 3 comments
-
Can you provide a full github repository? |
Beta Was this translation helpful? Give feedback.
-
@timneutkens Sure! Check out https://github.com/olaven/error-reproductions/tree/master/nextjs-api-route-error
|
Beta Was this translation helpful? Give feedback.
-
Ran
The correct Same if you open:
The output looks correct as well. Looks like your testing setup is wrong though. Particularly you're using Next.js internals that you shouldn't touch: Instead you can Going to convert this to a discussion as it's not a bug in Next.js, the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks for maintaining this useful framework!
Bug report
Describe the bug
update: This bug only appears in the node-test. It does not appear when fetching from the browser.
The dynamic query property (
[id].ts
) is undefined.My file is located in
pages/api/brands/[id].ts
.I am reading the id like this:
To Reproduce
/pages/api/posts/[id].ts
.request.query
.id
is undefinedExpected behavior
I expected the ID to have the value in my url, e.g.
/api/brands/some-id
.System information
EDIT: Removed template text
Beta Was this translation helpful? Give feedback.
All reactions