fix(node): Add compatibility layer for Prisma v5 #15169
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a shim to the internal Prisma tracing helper to prevent Prisma v5 from crashing when accessing a property on the tracing helper registered by the Prisma v6 integration that doesn't exist.
For more context see the upstream PR: prisma/prisma#26167
Note: I have tried to actually implement full compatibility, also emitting
prisma:engine
spans that contain the query. The problem is that these spans are passed by the prisma engine/binary to the TS layer individually, but in the format of a tree. The root node of the tree points to the current span when the query was made, however, since the nodes are passed individually, we cannot (at least with non-deprecated OTEL APIs) reconstruct that tree with materialzed (non-serialized) spans, because OTEL doesn't give you a way to set the IDs of spans.