Hi everyone, I’ve a next.js app the version is v14, with app router. I been trying to integrate auth0 and apollo libraries.
While creating authLink in apollo client file I need to access token in server side to apply header request. so there is example code
const authLink = setContext(async (_, { headers }) => {
let token = null;
try {
const session = await getSession();
token = session?.idToken;
} catch (e) {
console.error(e, "error getting session");
notFound();
}
const hasToken = token ? { authorization: `Bearer ${token}` } : {};
return {
headers: {
...headers,
...hasToken,
},
};
});
When try to build the project I get that error :
DynamicServerError: Dynamic server usage: Page couldn't be rendered statically because it used `cookies`.
I am appreciate any solution or idea here