Skip to content

Bug: getIdToken causing dynamic server usage error #310

@jan-clockworkwp

Description

@jan-clockworkwp

Prerequisites

Describe the issue

Not sure when this issue was introduced but this is the current built error with kinde-oss/kinde-auth-nextjs: 2.5.3. Full error message that is repeated for all routes:

getIdToken Error: Dynamic server usage: Route / couldn't be rendered statically because it used `cookies`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
    at m (.next/server/chunks/719.js:12:41210)
    at p (.next/server/chunks/668.js:1:349523)
    at <unknown> (.next/server/chunks/668.js:1:302789)
    at d (.next/server/chunks/668.js:1:290669)
    at o.value (.next/server/chunks/668.js:1:290447)
    at Generator.next (.next/server/chunks/668.js:1:291075)
    at lv (.next/server/chunks/668.js:1:295893)
    at a (.next/server/chunks/668.js:1:296096)
    at <unknown> (.next/server/chunks/668.js:1:296157)
    at new Promise (<anonymous>) {
  description: "Route / couldn't be rendered statically because it used `cookies`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error",
  digest: 'DYNAMIC_SERVER_USAGE'
}

My application is fully locked down via middleware. And the same issue is present even if I do not use useKindeBrowserClient, getKindeServerSession, nor KindeProvider in my code. I am using Next.js app router hierarchy.

Library URL

kinde-oss/kinde-auth-nextjs

Library version

2.5.3

Operating system(s)

macOS

Operating system version(s)

Sequoia 15.3.1

Further environment details

node v22
next v15

Reproducible test case URL

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions