We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Sometimes when I build the site Prisma throws a socket hangup error. It also happens locally time to time, and if I hard refresh it goes away.
Error:
Packages:
"@libsql/client": "^0.4.3", "@prisma/adapter-libsql": "^5.18.0", "prisma": "^5.18.0", "@prisma/client": "^5.18.0",
I'm creating the connection like this:
import { createClient } from '@libsql/client' import { PrismaLibSQL } from '@prisma/adapter-libsql' import { PrismaClient } from '@prisma/client' declare global { // eslint-disable-next-line no-var var cachedPrisma: PrismaClient } let prisma: PrismaClient if (process.env.NODE_ENV === 'production') { const libsql = createClient({ url: `${process.env.TURSO_DATABASE_URL}`, authToken: `${process.env.TURSO_AUTH_TOKEN}`, }) const adapter = new PrismaLibSQL(libsql) prisma = new PrismaClient({ adapter }) } else { if (!global.cachedPrisma) { const libsql = createClient({ url: `${process.env.TURSO_DATABASE_URL}`, authToken: `${process.env.TURSO_AUTH_TOKEN}`, }) const adapter = new PrismaLibSQL(libsql) global.cachedPrisma = new PrismaClient({ adapter }) } prisma = global.cachedPrisma } export const db = prisma
and then using db like this in my code:
db
const tableName = await db.tableName.findMany({ })
Is there something I can do to prevent this? Maybe I'm not doing the connection correctly.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Sometimes when I build the site Prisma throws a socket hangup error. It also happens locally time to time, and if I hard refresh it goes away.
Error:
Packages:
I'm creating the connection like this:
and then using
db
like this in my code:Is there something I can do to prevent this? Maybe I'm not doing the connection correctly.
The text was updated successfully, but these errors were encountered: