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

useAuthenticatedBlitzContext fails on vercel #4309

Open
cfragkos opened this issue Mar 8, 2024 · 8 comments
Open

useAuthenticatedBlitzContext fails on vercel #4309

cfragkos opened this issue Mar 8, 2024 · 8 comments
Labels
kind/bug Something isn't working status/triage

Comments

@cfragkos
Copy link

cfragkos commented Mar 8, 2024

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/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require.js

- /var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/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:

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

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

  return <div>{children}</div>;
}

What are detailed steps to reproduce this?

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 
@cfragkos cfragkos added kind/bug Something isn't working status/triage labels Mar 8, 2024
@cfragkos
Copy link
Author

cfragkos commented Mar 9, 2024

After searching I found the differences needed to achieve the error. I have made a public repo for you to check, download it make a .env with SESSION_SECRET_KEY and a mysql db url, and run it with pnpm vercel deploy. In the last commit it errors as I said, in the commit before that, named "works" it works.
Repo: https://github.com/cfragkos/blitz-test
TLDR: Next 14 instead of 13 breaks it

@gengjiawen
Copy link
Contributor

With #4311, next 14 works for me. Maybe you can try different deploy platform like flightcontrol or railway

@cfragkos
Copy link
Author

cfragkos commented Apr 2, 2024

@siddhsuresh @flybayer any updates on this?

@siddhsuresh
Copy link
Member

@cfragkos does version 2.0.6 fix this for you?

@cfragkos
Copy link
Author

cfragkos commented Apr 2, 2024

no

@cfragkos
Copy link
Author

@siddhsuresh any updates?

@flybayer
Copy link
Member

flybayer commented Apr 18, 2024

@cfragkos no, unfortunately we are unable to reproduce locally. This is a Vercel specific problem, and because they have lack of documentation, we are unable to investigate.

I recommend opening a Vercel support issue.

@gengjiawen
Copy link
Contributor

@timneutkens Can you take a look at this. Repro: https://github.com/gengjiawen/blitzjs-demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working status/triage
Projects
None yet
Development

No branches or pull requests

4 participants