Description
openedon Oct 14, 2024
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/aws-serverless
SDK Version
8.27.0
Framework Version
nodejs20.x
Link to Sentry event
No response
Reproduction Example/SDK Setup
Using the Serverless Framework v4 with AWS Lambdas.
import * as Sentry from '@sentry/aws-serverless'
import { nodeProfilingIntegration } from '@sentry/profiling-node'
Sentry.init({
dsn: process.env.SENTRY_DSN,
// Add Tracing by setting tracesSampleRate and adding integration
// Set tracesSampleRate to 1.0 to capture 100% of transactions
// We recommend adjusting this value in production
maxBreadcrumbs: 50,
debug: true,
integrations: [nodeProfilingIntegration()],
tracesSampleRate: 1.0,
initialScope: {
tags: { service: 'service-name' }
},
profilesSampleRate: 1.0
})
This leads to this error and my lambdas don't work (only when I include nodeProfilingIntegration)
2024-10-14T19:24:42.682Z undefined ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"The \"path\" argument must be of type string or an instance of URL. Received undefined","code":"ERR_INVALID_ARG_TYPE","stack":["TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be of type string or an instance of URL. Received undefined"," at Object.fileURLToPath (node:internal/url:1461:11)"," at Object.<anonymous> (/node_modules/@sentry/aws-serverless/src/sdk.ts:378:50)"," at Module._compile (node:internal/modules/cjs/loader:1469:14)"," at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)"," at Module.load (node:internal/modules/cjs/loader:1288:32)"," at Module._load (node:internal/modules/cjs/loader:1104:12)"," at Module.require (node:internal/modules/cjs/loader:1311:19)"," at require (node:internal/modules/helpers:179:18)"," at _tryRequireFile (file:///var/runtime/index.mjs:1002:37)"," at _tryRequire (file:///var/runtime/index.mjs:1052:25)"]}
If I remove nodeProfilingIntegration, my lambdas at least function, but I see TONS of "Sentry Logger [error]" everywhere in my lambda logs.
Those errors look like this:
2024-10-14T18:27:27.208Z 66c09dda-0a5d-44f3-898f-b69fe37785c8 ERROR Sentry Logger [error]: Failed to read file: /src/handler.ts. Error: Error: ENOENT: no such file or directory, open '/src/handler.ts'
2024-10-14T18:27:27.208Z 66c09dda-0a5d-44f3-898f-b69fe37785c8 ERROR Sentry Logger [error]: Failed to read file: /node_modules/@sentry/aws-serverless/src/sdk.ts. Error: Error: ENOENT: no such file or directory, open '/node_modules/@sentry/aws-serverless/src/sdk.ts'
Steps to Reproduce
Using Serverless Framework v4 with esbuild to write and deploy my AWS Lambda functions.
Here's my package.json:
{
"name": "service-name",
"private": true,
"version": "1.0.0",
"description": "",
"main": "src/handler.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"i": "yarn install --force"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@aws-sdk/client-ssm": "^3.645.0",
"@sentry/aws-serverless": "^8.27.0",
"@sentry/profiling-node": "^8.27.0",
"auth-utils": "./common/auth-utils",
"http-utils": "./common/http-utils",
"joi": "^17.13.3",
"axios": "^1.7.7",
"pg": "^8.12.0",
"pg-hstore": "^2.3.4",
"plaid": "^26.0.0",
"plaid-utils": "./common/plaid-utils",
"rds-utils": "./common/rds-utils",
"sequelize": "^6.37.3",
"temporal-utils": "./common/temporal-utils",
"types-and-constants": "./common/types-and-constants"
},
"devDependencies": {
"@types/node": "^14.14.31",
"serverless-domain-manager": "^7.3.8"
}
}
The lambdas are written in typescript and bundled with the built-in esbuild with serverless v4 in sls deploy
Expected Result
Expected result is for node profiling to work and to not have tons of random sentry errors everywhere in my lambda logs.
Actual Result
Logs attached above.
Metadata
Assignees
Type
Projects
Status
Waiting for: Community
Activity