Next.js Discord

Discord Forum

dynamic path segments returning bracket placeholders in outer.query after reload

Unanswered
Polar bear posted this in #help-forum
Open in Discord
Polar bearOP
I have a Next.js SSR app deployed on AWS Amplify. my file structure and path look like this

pages/
  app/
    [organizationName]/
      me/
        oneOnOne/
          [oneOnOneSettingID]/
            [oneOnOneID]/index.tsx

So the URL should be /app/<organizationName>/me/oneOnOne/<settingID>/<oneOnOneID>
It works locally(dev/prod) when I navigate client-side. However, after a full page reload on Amplify(or direct URL input), router.query still shows bracket placeholders instead of real values. For example here's the router object on reload.

{
  asPath: "/app/oinc/me/oneOnOne/d77c66c4-f83e-420a-b997-306219d60e2a/90de0249-2ad7-436b-a044-abae5bf25c0d",
  pathname: "/app/[organizationName]/me/oneOnOne/[oneOnOneSettingID]/[oneOnOneID]",
  query: {
    organizationName: "[organizationName]",
    oneOnOneSettingID: "[oneOnOneSettingID]",
    oneOnOneID: "[oneOnOneID]"
  },
  // ...
}


I've verified:
- No next export only next build → I'm using SSR, not a static export.
- Amplifys "Rewrite and Redirects" are set to rewrite all paths to the Next.js SSR handler. - My path struture and folder names match perfectly. - generate the URL with a leading slash(e.g., "/app/oinc/me/oneOnOne/d77c66c4-...") so it's an absolute path. - get the params from getServerSideProps's context Yet Amplify still returns bracked placeholders ([organizationName]`) in router.query after reload. Any idea what I might be missing in my Amplify or Next.js configuration to get SSR dynamic routes fully working?

0 Replies