-
Notifications
You must be signed in to change notification settings - Fork 404
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 instrumentation no longer works on >5.9.0 #1984
Comments
The issue stems from prisma/prisma@9c14954#diff-26d3d28d31824ef26252df77cca08d24faea8451cb8fd3ffee2000f9e496daa0 introduced by PR prisma/prisma#22630. |
In order to find out what went wrong, I created a minimal reproduction to try and understand how your tests were failing. Thanks to the context you left in this issue and elsewhere, I took a look at how you were resolving and injecting the Prisma Client. Then I came up with this reproduction: // index.ts
import { Hook } from 'require-in-the-middle'
new Hook(['@prisma/client'], {
}, function (exports, name) {
console.log('loading %s', name)
return exports
})
require('@prisma/client') With $ node -r esbuild-register index.ts
loading @prisma/client With $ node -r esbuild-register index.ts Somehow according to new Hook(['@prisma/client'], {
internals: true
}, function (exports, name) {
console.log('loading %s', name)
return exports
}) $ node -r esbuild-register index.ts
loading @prisma/client/runtime/library.js
loading @prisma/client/default.js Further down, I tried to understand why this would be an edge case if other libraries like The |
After taking a look at the source code of import { Hook } from 'require-in-the-middle'
async function main() {
new Hook(['@prisma/client/default'], {
internals: true
}, function (exports, name, basedir) {
console.log('loading %s', name)
return exports
})
require('@prisma/client')
}
void main() Let me know if that works for you. |
@millsp thanks for taking time to triage and fix. We do not pass cd test/versioned/prisma
npm i prisma@latest @prisma/client@5.10.0-integration-fix-client-exports-map.4 --no-save --no-package-lock
node prisma.tap.js |
Happy that we found a solution, and thanks for confirming the fix. |
This issue will serve to update the version ranges for our prisma versioned tests and just skip 5.9.0 |
Description
Prisma just released 5.9.0. It looks like they restructured exports to where instrumenting
@prisma/client
is not sufficient.Expected Behavior
Instrumentation of prisma 5.9.0+ will still function
Steps to Reproduce
cd test/versioned/prisma npm i prisma@latest @prisma/client@5.9.0 --no-save --no-package-lock node prisma.tap.js
Additional context
This will be an exercise in figuring out the appropriate paths to give to
shimmer.registerInstrumentations
. I've tried the following so far and it's very hard to determine the right paths. WIP branchYou can see the export changed
5.8.1 with debug on in require-in-the-middle
5.9.0
The text was updated successfully, but these errors were encountered: