Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: production issue #4311

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-tables-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blitzjs/auth": patch
---

Fix bundling issue that occurs in vercel due to the way imports were handled internally
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
Loading