Use Cache Directive with getSession

for anyone using getSession in nextjs, and not using cookieCache for the sessions but instead the 'use cache' directive, be aware that calling await headers() like this will make caching not work since headers are non-serializable, @bekacru any workaround here? Maybe only passing the authorization header in the getSession parameter? doing await headers() inside the api.getSession will not be allowed with the use cache directive, so it has to be outside of the functions scope
image.webp
Was this page helpful?