Repository navigation
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.7.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
// Preloaded using node --import flag. Do not import code from other source files here.
// https://docs.sentry.io/platforms/javascript/guides/node/install/esm/
// @ts-check
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import * as Sentry from '@sentry/node'
import { nodeProfilingIntegration } from '@sentry/profiling-node'
/**
* The root directory of the application.
* @see {@link https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/rewriteframes/}
*/
const root = dirname(fileURLToPath(import.meta.url))
const env =
process.env['SENTRY_ENV'] || process.env['NODE_ENV'] || 'development'
const version = process.env['PACKAGE_VERSION']
Sentry.init({
dsn: 'redacted',
release: version ? `api@${version}` : undefined,
environment: env,
integrations: [
nodeProfilingIntegration(),
Sentry.dedupeIntegration(),
Sentry.rewriteFramesIntegration({ root }),
Sentry.prismaIntegration(),
],
beforeBreadcrumb: (breadcrumb) => {
// Filter out writes to apollographql reporting API, because they are not helpful for error tracing
// and spam breadcrumbs.
if (
breadcrumb.type === 'http' &&
typeof breadcrumb.data?.['url'] === 'string' &&
breadcrumb.data['url'].includes('api.apollographql.com')
) {
return null
}
return breadcrumb
},
tracesSampleRate: 0.1,
profilesSampleRate: 0.1,
})
Steps to Reproduce
I migrated my code to Sentry v8 and can no longer start my application. I start my app using node --import ./instrument.js ./dist/main.js. I use pnpm as my package manager.
Expected Result
Prisma v8 should work using ESM, pnpm, and prisma.
Actual Result
Error: Cannot find module '.prisma/client/default'
Require stack:
- /Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/lib/get-exports.js
- /Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/hook.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Function.resolve (node:internal/modules/helpers:136:19)
at /Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/lib/get-exports.js:26:33
at Array.map (<anonymous>)
at getFullCjsExports (/Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/lib/get-exports.js:23:40)
at getExports (/Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/lib/get-exports.js:83:12)
at async processModule (/Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/hook.js:134:23)
at async getSource (/Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/hook.js:269:60)
at async load (/Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/hook.js:335:26)
at async nextLoad (node:internal/modules/esm/hooks:833:22) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/lib/get-exports.js',
'/Users/pascal/code/ips-hosting/api/node_modules/.pnpm/import-in-the-middle@1.7.4/node_modules/import-in-the-middle/hook.js'
]
}
Reacted by Jeffrey Yasskin
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
AbhiPrasad commentedon Jun 3, 2024
This should be fixed by our
import-in-the-middlefixes. @P4sca1 could you try using the patch we have to validate this: #12242 (comment)If the patch works, fix is released with open-telemetry/opentelemetry-js#4745
P4sca1 commentedon Jun 3, 2024
I tried to apply the following patch file using ppm, but still have the same issue.
P4sca1 commentedon Jun 3, 2024
Here is how I import prisma:
AbhiPrasad commentedon Jun 3, 2024
Shoot. one last thing to try then, could you override
import-in-the-middleto use1.8.0to see if that fixes it?{ "pnpm": { "overrides": { "import-in-the-middle": "^1.8.0", } } }if this doesn't work, it's def another bug we have to look into. We'll investigate and fix asap. Sorry for the trouble.
22 remaining items
timfish commentedon Jun 12, 2024
Because prisma is CJS, I think this is fixed by nodejs/import-in-the-middle#96 but I need to confirm
timfish commentedon Jun 15, 2024
This should hopefully have been fixed by the numerous PRs recently merged at
import-in-the-middle.While we wait for this to be released, there is a patch available that combines all the fixes. If anyone can confirm this patch fixes this issue that would be super helpful!
P4sca1 commentedon Jun 26, 2024
The issue persists with
import-in-the-middle@1.8.1. I updated my reproduction with the latest version.timfish commentedon Jun 26, 2024
This is still waiting for this PR to be merged.
AbhiPrasad commentedon Jul 8, 2024
With the newest release of
import-in-the-middlev1.9.0this should be fixed.If you upgrade to a fresh install of the latest version of the Node SDK it should use
import-in-the-middle@1.9.0by default.