blitz-js / legacy-framework

MIT License
3 stars 2 forks source link

ctx.session is undefined when deployed on vercel #315

Closed Jaxenormus closed 2 years ago

Jaxenormus commented 3 years ago

What is the problem?

On blitz version 0.40.0-canary.7 ctx.session is undefined when hosted on vercel, I haven't tested an earlier version

Paste all your error logs here:

2021-08-30 23:03:43.310 INFO signup() Starting with input: 
{
name: 'Caleb',
email: 'test@test.com',
password: '[***]',
betaInvite: '9D6F7DFE-FCB6-45CD-8C29-3AB2796A20F3'
}
2021-08-30 23:03:44.367 ERROR signup() 
 TypeError  Cannot read property '$create' of undefined
error stack:
• signup.js:161 <anonymous>
.next/serverless/pages/api/rpc/signup.js:161:21
• blitzjs-core-server.cjs.prod.js:22 <anonymous>
node_modules/@blitzjs/core/server/dist/blitzjs-core-server.cjs.prod.js:22:20
• api-utils.js:164 <anonymous>
node_modules/next/dist/server/api-utils.js:164:32
• middleware.js:39 handleRequestWithMiddleware
node_modules/next/dist/server/middleware.js:39:9
• api-utils.js:112 apiResolver
node_modules/next/dist/server/api-utils.js:112:13
• 8277.js:40 <anonymous>
.next/serverless/chunks/8277.js:40:13

Paste all relevant code snippets here:

await ctx.session.$create({ userId: user.id, role: Role.USER })

What are detailed steps to reproduce this?

  1. Create a blitz app with auth on version 0.40.0-canary.7
  2. Deploy to vercel

Run blitz -v and paste the output here:

PASTE_HERE (leave the ``` marks)

Please include below any other applicable logs and screenshots that show your problem:

No response

flybayer commented 2 years ago

Fixed in https://github.com/blitz-js/blitz/pull/2730