Next.js Discord

Discord Forum

Confusing `Route ... used `...params` or similar expression. `params` should be awaited...` error

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
I'm a bit stumped - adding a seemingly unrelated line of code causes an dynamic params await error, as title states:
Error: Route "/user/[id]" used `...params` or similar expression. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis
    at JSON.stringify (<anonymous>)
    at eval (src/components/data-table/index.tsx:266:29)
    at Array.map (<anonymous>)
    at DataTable (src/components/data-table/index.tsx:240:31)
  264 |                 style={{ textAlign }}
  265 |                 className={styles.grow}
> 266 |                 title={JSON.stringify(value)}
      |                             ^
  267 |               >
  268 |                 {UNFORMATTED_VALUES.includes(key) ? (
  269 |                   <DefaultValueTypography value={value || "—"} />


Uncommenting the title prop line makes the error go away. The page that is mentioned does await the params. Anyone have any clue what this could be caused by? Just seems like a false negative to me. 🤷‍♂️

4 Replies

Sun bearOP
Bump?
Pacific sand lance
can you show how are you accessing id param?
Sun bearOP
export default async function Page(props: { params: Promise<{ id: string }> }) {
  const params = await props.params;
  const { id } = params;
Sun bearOP
Bump