-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Prisma Integration Incompatible with 5.0.0 #8532
Comments
Hello, thank you for writing in! I think we may fix this in the process of #8534 - we are currently starting to work on revamping the whole underlying performance tracing functionality of the Node SDK, which will allow us to just leverage e.g. https://www.npmjs.com/package/@prisma/instrumentation, which should hopefully also work with v5. |
(Prisma here) Prisma 5.0.0 has not fundamentally changed anything, beyond that we adapted the internal protocol that Prisma Client talks to the internal Query Engine. Before it was GraphQL-like, now it is a custom Json. (This actually existed since Prisma 4.11.0 with the Not sure if this is what causing the problem here though. The error above seems to be from a If someone creates a small reproduction example of a working Prisma integration with Prisma 4.16.2, I am happy to take a look at what could be going on when upgrading to Prisma 5.0.0 (or enabling the preview feature with 4.16.2 itself). |
I'm also seeing this with Prisma 4.14.1 and @sentry/nextjs 7.59.3 |
Do you have |
@janpio I have previewFeatures = ["fullTextSearch", "postgresqlExtensions"] set |
That would go against my theory above. Still would appreciate a minimal reproduction of the problem so I can play with it. I know nothing about Sentry, so creating one will not be trivial for me. |
Hi! import { PrismaClient } from '@prisma/client'
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined
}
export const prisma = globalForPrisma.prisma ?? new PrismaClient()
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma I've tried combining that with Sentry's integration, so it would look something like this: import { PrismaClient } from '@prisma/client'
import * as Sentry from '@sentry/node'
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined
}
const prisma = globalForPrisma.prisma ?? new PrismaClient()
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
export default prisma
Sentry.init({
dsn: 'my-sentry-dsn',
release: '1.0',
tracesSampleRate: 1.0,
integrations: [new Sentry.Integrations.Prisma({ client: prisma })],
}) Unfortunately, it made me run into the same issues as stated above, ie the circular error. |
Thanks. Can you @FaresKi maybe put a minimal Next.js project with just this needed code in a Github repo? As I said before, happy to try this out - but no experience with Sentry, so hesitant to set something up myself. Thanks. |
Glad to help! |
Yes, I have an account available - might just need some pointers to know what to do exactly. So some code, and some light instructions should be enough for me to figure out the rest. |
While I was preparing the reproducible, I've noticed the problem being solved when upgrading Prisma to the latest release (same as Sentry). |
Hi again guys! I realized in my project that I had a double initialisation of Sentry! One without the integration and one with! Multiple instances and/or incorrect initialisation localisation may cause unexpected JSON stringifications. Just something to keep in mind. The good news is that it now definitely works. |
`JSON.stringify` will throw when called on circular structures. This is an unnecessary risk in the prisma integration so we just log it plainly. Ref: #8532
I am gonna remove the |
lforst 's fix resolves this issue for me (the other ideas did not). |
Any idea when this will be released? |
@tyteen4a03 I'd assume in the upcoming days. |
Fix has been released. |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/serverless
SDK Version
7.58.1
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
Expected Result
Route would load as previous.
Actual Result
The text was updated successfully, but these errors were encountered: