Issue with BetterFetch on vps

When running the app on vercel everything seems to work
But as soon as i switch over to my own vps i keep getting BetterFetch issues it seems..

Error fetching session: Error: fetch failed
    at context.fetch (/app/node_modules/next/dist/server/web/sandbox/context.js:322:60)
    at tN (/app/.next/server/src/middleware.js:13:45496)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async tB (/app/.next/server/src/middleware.js:13:50025)
    at async tW (/app/.next/server/src/middleware.js:13:51099)
    at async handler (/app/.next/server/src/middleware.js:13:51668)
    at async /app/.next/server/src/middleware.js:13:37403
    at async ti (/app/.next/server/src/middleware.js:13:33929)
    at async /app/node_modules/next/dist/server/web/sandbox/sandbox.js:108:26
    at async runWithTaggedErrors (/app/node_modules/next/dist/server/web/sandbox/sandbox.js:105:9) {
}



if (!pathname.startsWith("/api")) {
    try {
      const { data } = await betterFetch<Session>("/api/auth/get-session", {
        baseURL: req.nextUrl.origin,
        headers: {
          cookie: req.headers.get("cookie") || "",
        },
      });
      session = data;
    } catch (error) {
      console.error("Error fetching session:", error);
    }
  }


I got no clue what the reason could be, any thoughts?
Was this page helpful?