Causes following error when open localhost:3000.
( But the result seems to be no problem. )
(node:31313) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '_clientVersion' of undefined
at $connect (/Users/isoppp/workspace/oss/_testing/node_modules/@prisma/client/runtime/index.js:77960:32)
at eval (webpack-internal:///./pages/api/auth/mutations/logout.ts:33:81)
at /Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/server/dist/server.cjs.development.js:1585:11
at dispatch (/Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/core/dist/core.cjs.development.js:858:32)
at /Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/server/dist/server.cjs.development.js:2397:12
at dispatch (/Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/core/dist/core.cjs.development.js:858:32)
at /Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/core/dist/core.cjs.development.js:866:12
at /Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/core/dist/core.cjs.development.js:769:30
at _catch (/Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/core/dist/core.cjs.development.js:732:18)
at Object.handleRequestWithMiddleware (/Users/isoppp/workspace/oss/_testing/node_modules/@blitzjs/core/dist/core.cjs.development.js:768:28)
npx blitz@canary new .yarn run blitz run migrateyarn startblitz: 0.25.0-canary.1 (local)
Package manager: yarn
System:
OS: macOS 10.15.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 1.49 GB / 16.00 GB
Shell: 3.1.0 - /usr/local/bin/fish
Binaries:
Node: 12.16.0 - /var/folders/xt/4fshmzms3s13prm5t364p_xm0000gp/T/yarn--1604420868303-0.857300376614728/node
Yarn: 1.22.5 - /var/folders/xt/4fshmzms3s13prm5t364p_xm0000gp/T/yarn--1604420868303-0.857300376614728/yarn
npm: 6.13.4 - ~/.anyenv/envs/nodenv/versions/12.16.0/bin/npm
Watchman: Not Found
npmPackages:
@prisma/cli: 2.10.2 => 2.10.2
@prisma/client: 2.10.2 => 2.10.2
blitz: 0.25.0-canary.1 => 0.25.0-canary.1
react: 0.0.0-experimental-7f28234f8 => 0.0.0-experimental-7f28234f8
react-dom: 0.0.0-experimental-7f28234f8 => 0.0.0-experimental-7f28234f8
typescript: 4.0.5 => 4.0.5
this scopeI guess it has happened since https://github.com/blitz-js/blitz/pull/1342/files .
To fix it, probably its line should be like
connect = require('db').connect ?? (db?.$connect || db?.connect) ? (() => db.$connect ? db.$connect() : db.connect()) : (() => {})
I couldn't get how to run regular query in https://github.com/blitz-js/blitz/issues/1331 so I couldn't test enough.
Run a regular query that doesn't access a database
If I will be able to get the meaning and reproducing methods, I would be able to make PR.
Interesting, I was thinking it was a bug in prisma, but you do have a good theory here since this doesn't happen with 0.24.3.
@flybayer
Could I get detailed reproduce steps of Run a regular query that doesn't access a database in #1331 ?
I'm going to make a PR to fix this
I got this issue too.
"@prisma/client": "2.10.2"
"blitz": "0.25.0-canary.1"
CMIIW @flybayer
I think the meaning of Run a regular query that doesn't access a database is kinda like this:
import { Ctx } from 'blitz'
import db, { FindManyJournalArgs } from 'db'
type GetJournalsInput = Pick<
FindManyJournalArgs,
'where' | 'orderBy' | 'skip' | 'take'
>
export default async function getJournals(
{ where, orderBy, skip = 0, take }: GetJournalsInput,
ctx: Ctx,
) {
// ctx.session.authorize()
// ctx.session.authorize(['super-admin', 'admin', 'journal-reader'])
// const journals = await db.journal.findMany({
// select: {
// id: true,
// },
// where,
// orderBy,
// take,
// skip,
// })
// const count = await db.journal.count()
// const hasMore = typeof take === 'number' ? skip + take < count : false
// // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
// const nextPage = hasMore ? { take, skip: skip + take! } : null
return {
journals: [],
nextPage: 1,
hasMore: true,
count: 1,
}
}
I get this issue too and hopefully @isoppp pull request can fix the issue completely
@isoppp yes, don't use a db like @rayandrews showed
Thank you for the example!
I'll try to fix this :)
Update: #1419 didn't actually change anything on this.
The real solution is to do rm -rf .blitz 🤦♂️
I've opened https://github.com/blitz-js/blitz/issues/1421 to address the core problem here, which is outdated build cache that uses an older version of blitz code.
hmm, I think that to fix this issue, needs #1419 modification. But yes, also need to delete .blitz cache once.
Before applying #1419 modification, this error will happen even if delete the cache.
Most helpful comment
hmm, I think that to fix this issue, needs #1419 modification. But yes, also need to delete
.blitzcache once.Before applying #1419 modification, this error will happen even if delete the cache.