blitz-js / blitz-js/blitz

useAuthenticatedBlitzContext fails on vercel

Open
#4,309 9 comments 0 reactions 0 assignees View on GitHub
kind/bug status/triage
Dominant language
TypeScript
Stars
14.1k
Forks
803
PR merge metrics
No merged PRs in 30d

Description

### What is the problem?

using useAuthenticatedBlitzContext in a server component layout creates this error, as well as getBlitzContext

### Paste all your error logs here:

```

Error: Cannot find module 'debug'

Require stack:

- /var/task/.next/server/app/(main)/page.js

- /var/task/node_modules/.pnpm/next@14.1.3_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/require.js

- /var/task/node_modules/.pnpm/next@14.1.3_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/next-server.js

- /var/task/___next_launcher.cjs

- /opt/node-bridge/chunk-N3ULQXIM.js

- /opt/node-bridge/chunk-5UAC7W5H.js

- /opt/node-bridge/vercel-tla.js

- /var/task/___vc/__launcher/__launcher.js
```

### Paste all relevant code snippets here:

```tsx
import { useAuthenticatedBlitzContext } from '@/blitz-server';

export default async function MainLayout({
children,
}: {
children: React.ReactNode;
}) {
await useAuthenticatedBlitzContext({
redirectTo: '/login',
});

return

{children}
;
}

```

### What are detailed steps to reproduce this?

1.

### Run `blitz -v` and paste the output here:

```
Blitz version: 2.0.5 (local)
Linux 5.15 | linux-x64 | Node: v20.11.0

Package manager: pnpm

System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
Memory: 11.05 GB / 15.19 GB
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: Not Found
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
npmPackages:
@blitzjs/auth: 2.0.5 => 2.0.5
@blitzjs/next: 2.0.5 => 2.0.5
@blitzjs/rpc: 2.0.5 => 2.0.5
@prisma/client: ^5.8.1 => 5.10.2
blitz: 2.0.5 => 2.0.5
next: 14.1.3 => 14.1.3
prisma: ^5.8.1 => 5.10.2
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
typescript: 5.4.2 => 5.4.2
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.