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?
Self-hosted/on-premise
Which SDK are you using?
@sentry/nestjs
SDK Version
8.47.0
Framework Version
NestJS 10.3.7
Link to Sentry event
No response
Reproduction Example/SDK Setup
import * as Sentry from '@sentry/nestjs';
import dotenv from 'dotenv';
dotenv.config();
if (!process.env.SENTRY_DSN) {
throw new Error('process.env.SENTRY_DSN is not defined');
}
if (!process.env.SENTRY_ENV) {
throw new Error('process.env.SENTRY_ENV is not defined');
}
Sentry.init({
dsn: process.env.SENTRY_DSN,
sampleRate: 0.1,
environment: process.env.SENTRY_ENV,
});
Steps to Reproduce
- Install
@sentry/nestjs
package - Add eslint and eslint-import-plugin to your project (you may also just clone https://github.com/abriginets/nest-starter)
- Try importing something from
@sentry/nestjs
. You'll get eslint error
Unable to resolve path to module '@sentry/nestjs'. (eslint import/no-unresolved)
This occurs because of the bad path in package.json
of @sentry/nestjs
:
"main": "build/cjs/nestjs/index.js",
"module": "build/esm/nestjs/index.js",
If you look into filesystem, there won't be nestjs
dir.
I've been able to successfully patch this by creating nestjs
directory under node_modules/@sentry/nestjs/build/cjs/
and by putting all the files from aforementioned directory into it.
The error was gone after this.
Expected Result
Files location should correspond to what's declared in package.json
Actual Result
Files location and package.json
declaration mismatch
Metadata
Metadata
Assignees
Type
Projects
Status
No status