DennisK
DennisK
Explore posts from servers
PPrisma
Created by samuelcole on 9/10/2024 in #help-and-questions
Optimize is not showing queries
Nope sorry, it is not OS.
32 replies
PPrisma
Created by DennisK on 9/10/2024 in #help-and-questions
Prisma Transactions stops working once you extend the client with Pulse, Optimize or Accelerate
It is just so buggy. You need to extend the client like this in order to get $on and $transaction to work. But when you will do that, the Extensions are not being picked up by the LSP or even not functioning at all
const client = new PrismaClient({
log: [
{ level: 'query', emit: 'event' },
{ level: 'error', emit: 'stdout' },
{ level: 'warn', emit: 'stdout' },
],
})

client.$extends(withAccelerate())
client.$extends(
withPulse({
apiKey: process.env.PULSE_API_KEY,
}),
)
client.$extends(withOptimize({ apiKey: process.env.OPTIMIZE_API_KEY }))

client.$on('query', async (e) => {
if (e.duration < logThreshold) return
const color =
e.duration < logThreshold * 1.1
? 'green'
: e.duration < logThreshold * 1.2
? 'blue'
: e.duration < logThreshold * 1.3
? 'yellow'
: e.duration < logThreshold * 1.4
? 'redBright'
: 'red'
const dur = chalk[color](`${e.duration}ms`)

console.info(`prisma:query - ${dur} - ${e.query}`)
})
const client = new PrismaClient({
log: [
{ level: 'query', emit: 'event' },
{ level: 'error', emit: 'stdout' },
{ level: 'warn', emit: 'stdout' },
],
})

client.$extends(withAccelerate())
client.$extends(
withPulse({
apiKey: process.env.PULSE_API_KEY,
}),
)
client.$extends(withOptimize({ apiKey: process.env.OPTIMIZE_API_KEY }))

client.$on('query', async (e) => {
if (e.duration < logThreshold) return
const color =
e.duration < logThreshold * 1.1
? 'green'
: e.duration < logThreshold * 1.2
? 'blue'
: e.duration < logThreshold * 1.3
? 'yellow'
: e.duration < logThreshold * 1.4
? 'redBright'
: 'red'
const dur = chalk[color](`${e.duration}ms`)

console.info(`prisma:query - ${dur} - ${e.query}`)
})
Makes me really wonder if it's worth the risk paying for these products for a production grade app
4 replies
PPrisma
Created by samuelcole on 9/10/2024 in #help-and-questions
Optimize is not showing queries
I have the same
32 replies
PPrisma
Created by DennisK on 9/10/2024 in #help-and-questions
Whenever you extend your PrismaClient with Pulse, you don't have access to $on anymore. Why?
No description
3 replies
PPrisma
Created by DennisK on 9/10/2024 in #help-and-questions
Supabase with Pulse and Accelerate
All right. So there is no connection pooler connection anymore since I also used the 5432 one to connect Supabase with Accelerate. Leaves the question: What is this connection pooler (the one of Supabase) actually doing? I am missing the knowledge so just asking 🙂 And will it be compatible with Prisma in the near future?
4 replies
PPrisma
Created by DennisK on 9/9/2024 in #help-and-questions
Is SQlite supported any time soon? Pulse & Accelerate
Ok! No worries. I am migrating all over to Supabase Postgres and using Pulse like this. Hope Supabase support will improve soon
4 replies