Skip to content

prismaInstrumentation.PrismaInstrumentation is not a constructor #11216

@gajus

Description

@gajus

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

8.0.0-alpha.4

Framework Version

No response

Link to Sentry event

No response

SDK Setup

N/A

Steps to Reproduce

Load script with node --loader=import-in-the-middle/hook.mjs ./dist/bin/server.js

Gives error:

030292a3 > This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
030292a3 > TypeError: prismaInstrumentation.PrismaInstrumentation is not a constructor
030292a3 >     at Object.setupOnce (file:///Users/x/Developer/contra/gaia/node_modules/.pnpm/@[email protected]/node_modules/@sentry/node/esm/index.js:2075:11)
030292a3 >     at setupIntegration (file:///Users/x/Developer/contra/gaia/node_modules/.pnpm/@[email protected]/node_modules/@sentry/core/esm/index.js:4927:17)
030292a3 >     at file:///Users/x/Developer/contra/gaia/node_modules/.pnpm/@[email protected]/node_modules/@sentry/core/esm/index.js:4897:7
030292a3 >     at Array.forEach (<anonymous>)
030292a3 >     at setupIntegrations (file:///Users/x/Developer/contra/gaia/node_modules/.pnpm/@[email protected]/node_modules/@sentry/core/esm/index.js:4894:16)
030292a3 >     at NodeClient._setupIntegrations (file:///Users/x/Developer/contra/gaia/node_modules/.pnpm/@[email protected]/node_modules/@sentry/core/esm/index.js:5396:26)
030292a3 >     at NodeClient.init (file:///Users/x/Developer/contra/gaia/node_modules/.pnpm/@[email protected]/node_modules/@sentry/core/esm/index.js:5249:12)
030292a3 >     at init (file:///Users/x/Developer/contra/gaia/node_modules/.pnpm/@[email protected]/node_modules/@sentry/node/esm/index.js:3104:12)
030292a3 >     at createSentry (file:///Users/x/Developer/contra/gaia/packages/sentry/dist/node.js:69:5)
030292a3 >     at file:///Users/x/Developer/contra/gaia/apps/contra-api/src/bin/server.ts:1:205

What worked was a dumb patch:

diff --git a/esm/index.js b/esm/index.js
index d9f5c81971e65b60e49a9ae7502c710bb4d2bd9d..bd28c7836c5b9e9075e611a117d80c1d66e7a82a 100644
--- a/esm/index.js
+++ b/esm/index.js
@@ -2072,7 +2072,7 @@ const _prismaIntegration = (() => {
       registerInstrumentations({
         instrumentations: [
           // does not have a hook to adjust spans & add origin
-          new prismaInstrumentation.PrismaInstrumentation({}),
+          // new prismaInstrumentation.PrismaInstrumentation({}),
         ],
       });
     },

All other modules load fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPackage: nodeIssues related to the Sentry Node SDK

    Projects

    Status

    No status

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions