Skip to content

[Bug]: Dynamic api route does not pass query params #1726

Closed
@strefalinkow

Description

@strefalinkow

Summary

Hi, after a week, I re-deployed the next.js app to netlify via auto deploy with the same code & dependency versions and I am not getting query parameters in a dynamic route.

My api route: pages/api/post/[id]/delete.js:

export default function handler(req, res) {
  console.log(req.query.id);
}

When I hit /api/post/123/delete the req.query.id is "[id]".

Exactly the same next.js code deployed on netlify week later occurs this error.

So I specified the versions during the build (node, npm etc.) from the last successfull deploy, cleared the cache - nothing helped.
I also deployed the app on a different next.js hosting platform and this error does not occur.
I don't get any warnings or errors during build.

The last successful deployment dates back to October 10, where 4.24.3 plugin-nextjs version was used by netlify.
Plugin-nextjs version used by netlify with this bug - 4.28.1

Have there been any changes between these versions that may cause this error?
On the netlify platform, I can only manually set the full versions of the plugin (1, 3, 4).

Thanks.

Steps to reproduce

Log query param in a dynamic route.

A link to a reproduction repository

No response

Next Runtime version

4.28.1

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

Windows

Your netlify.toml file

`netlify.toml`
# Paste content of your `netlify.toml` file here

Your public/_redirects file

`_redirects`
# Paste content of your `_redirects` file here

Your next.config.js file

`next.config.js`
const nextTranslate = require("next-translate");

module.exports = {
  images: {
    domains: ["firebasestorage.googleapis.com"],
  },
  reactStrictMode: true,
  ...nextTranslate(),
};

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
# Paste logs here

.next JSON files

generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions