From c393318f7ad4135ab21ae4678f8edf72836402af Mon Sep 17 00:00:00 2001 From: Jiawen Geng Date: Wed, 13 Mar 2024 07:19:00 +0000 Subject: [PATCH 1/2] fix: production issue --- .changeset/soft-tables-ring.md | 5 +++++ packages/blitz-auth/src/server/auth-sessions.ts | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changeset/soft-tables-ring.md diff --git a/.changeset/soft-tables-ring.md b/.changeset/soft-tables-ring.md new file mode 100644 index 0000000000..3a8dfb2bd5 --- /dev/null +++ b/.changeset/soft-tables-ring.md @@ -0,0 +1,5 @@ +--- +"@blitzjs/auth": patch +--- + +fix production issues diff --git a/packages/blitz-auth/src/server/auth-sessions.ts b/packages/blitz-auth/src/server/auth-sessions.ts index b067b024c6..35f4f90363 100644 --- a/packages/blitz-auth/src/server/auth-sessions.ts +++ b/packages/blitz-auth/src/server/auth-sessions.ts @@ -183,8 +183,7 @@ export async function getSession( export async function getBlitzContext(): Promise { try { - //using eval to avoid bundling next/headers - const {headers, cookies} = eval("require('next/headers')") + const {headers, cookies} = require("next/headers") const req = new IncomingMessage(new Socket()) as IncomingMessage & { cookies: {[key: string]: string} } @@ -234,8 +233,7 @@ export async function useAuthenticatedBlitzContext({ const ctx: Ctx = await getBlitzContext() const userId = ctx.session.userId try { - //using eval to avoid bundling next/navigation - const {redirect} = eval("require('next/navigation')") + const {redirect} = require("next/navigation") if (userId) { debug("[useAuthenticatedBlitzContext] User is authenticated") if (redirectAuthenticatedTo) { From e505cab8384c162ad55086f6d3eeab0d70b3688a Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Mon, 1 Apr 2024 18:13:17 +0530 Subject: [PATCH 2/2] Update .changeset/soft-tables-ring.md --- .changeset/soft-tables-ring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/soft-tables-ring.md b/.changeset/soft-tables-ring.md index 3a8dfb2bd5..1c77ff69eb 100644 --- a/.changeset/soft-tables-ring.md +++ b/.changeset/soft-tables-ring.md @@ -2,4 +2,4 @@ "@blitzjs/auth": patch --- -fix production issues +Fix bundling issue that occurs in vercel due to the way imports were handled internally