#@pticon just to confirm, if I send query

1 messages · Page 1 of 1 (latest)

warm sigil
#

the rewrite should work for path only for what I know so far. The link I've sent was the first thing I've found mentioning the issue you are experiencing.

What are you trying to achieve exactly?

teal silo
# warm sigil the rewrite should work for path only for what I know so far. The link I've sent...

so this thing is as it is

const nextConfig = {
  async rewrites() {
    return [
      {
        source: "/joinTeam",
        destination: "/",
      },
    ];
  },
};

now, I encountered this issue just today. Before this when I had set it up and the days following it, this used to work fine. I send 2 query paramters in the URL itself and I was able to get them on my / route because of the rewrite. But I did not mention them in the config.

Now just today, I saw this feature is broken where a user can come on this link to join a team, based on the query parameters I send. It doesn't matter if I send a query parameter or not, even if I do just /joinTeam, I get a 404 page

warm sigil
#

how do you send query params?

I don't think you can specify query params on rewrite, rewrite should care only about path. If I type some random query like /joinTeam?x=y, rewrite still works. So the core of the issue must be somwhere else in your case.

teal silo
warm sigil
#

I don't think this is really related to query params, as you can basically type anything there and just not use it.

Try to add another rewrite to the array, e.g.:

      {
        source: "/hello",
        destination: "/",
      },

Ad than access the path and see what will happend. Unfortunately I don't have any experience with page router

teal silo
warm sigil
#

Are you using middleware?

teal silo
warm sigil
#

ok, any issues in console server/client?

teal silo
#

my next config other than the above includes sentry and the next bundle analyzer, both of which did not give any issues before this

teal silo
#

WAIT

#

I FOUND IT

warm sigil
#

sometimes it just helps to turn off the server, remove .next and node_modules, reinstall and rerun. If this does not help, I would start disabling the modules

teal silo
#

ok so I did not notice but I was actually working from a branch and not from main

#

it seems the issue is lazy loading

#

the branch that I was trying from, has all code related to lazy loading

#

that I optimised for the app just recently

warm sigil
#

interesting. Now am wondering why would lazy loading affect routes

#

anyway good for you, and good to know, this kind of issue

teal silo
teal silo
#

thank you for your time! 🙌