⨯ TypeError: Cannot read properties of undefined (reading 'bind')

hi! Can someone please help me with this issue: ⨯ TypeError: Cannot read properties of undefined (reading 'bind') at h (.next/server/chunks/999.js:1:8478) at l (.next/server/chunks/999.js:1:8118) at l (.next/server/app/dashboard/page.js:1:20979) { digest: '3113189919' } I went into those chunks and it's from this:
export const dynamic = 'force-dynamic';
export default async function DashboardPage() {
const data = await getStocks();
const headersList = await headers();
const session = await auth.api.getSession({
headers: headersList
});
if (!session) return null;
return (
export const dynamic = 'force-dynamic';
export default async function DashboardPage() {
const data = await getStocks();
const headersList = await headers();
const session = await auth.api.getSession({
headers: headersList
});
if (!session) return null;
return (
This is the code from files which stack trace has:
h((0,a.getExpectedRequestStore)("headers").headers)}let f=new WeakMap;function h(e){let t=f.get(e);if(t)return t;let r=Promise.resolve(e);return f.set(e,r),Object.defineProperties(r,{append:{value:e.append.bind(e)},delete:{value:e.delete.bind(e)},get:{value:e.get.bind(e)},has:{value:e.has.bind(e)},set:{value:e.set.bind(e)},getSetCookie:{value:e.getSetCookie.bind(e)},forEach:{value:e.forEach.bind(e)},keys:{value:e.keys.bind(e)},values:{value:e.values.bind(e)},entries:{value:e.entries.bind(e)},[Symbol.iterator]:{value:e[Symbol.iterator].bind(e)}}),r}
h((0,a.getExpectedRequestStore)("headers").headers)}let f=new WeakMap;function h(e){let t=f.get(e);if(t)return t;let r=Promise.resolve(e);return f.set(e,r),Object.defineProperties(r,{append:{value:e.append.bind(e)},delete:{value:e.delete.bind(e)},get:{value:e.get.bind(e)},has:{value:e.has.bind(e)},set:{value:e.set.bind(e)},getSetCookie:{value:e.getSetCookie.bind(e)},forEach:{value:e.forEach.bind(e)},keys:{value:e.keys.bind(e)},values:{value:e.values.bind(e)},entries:{value:e.entries.bind(e)},[Symbol.iterator]:{value:e[Symbol.iterator].bind(e)}}),r}
(24265),a=r(44999),o=r(45424);let u="force-dynamic";async function l(){let e=await (0,i.yW)(),t=await (0,a.b3)();
(24265),a=r(44999),o=r(45424);let u="force-dynamic";async function l(){let e=await (0,i.yW)(),t=await (0,a.b3)();
This happens only when i build and run start. Next.js is behind Caddy reverse proxy but it does work properly when in dev mode. I checked ssr as well and that page is def SSR and not static. Please help me out
1 Reply
Ping
Ping3mo ago
Not sure from this, there isn't enough information to have an answer If you removed everything related to Better-auth in that file, does everything work?

Did you find this page helpful?