Skip to content

Commit

Permalink
fix: production issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gengjiawen committed Mar 13, 2024
1 parent 744242f commit 60eb149
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/blitz-auth/src/server/auth-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ export async function getSession(

export async function getBlitzContext(): Promise<Ctx> {
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}
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 60eb149

Please sign in to comment.