AWS Lambda NodeJs errors not sent to Sentry

Hello communauty,

I have deployed the Cloudformation stack Sentry-Monitoring-Stack as recommended in documentation and while perfomance information is captured and displayed in my Sentry dashboard, errors / events are not, there are no issues detected even when I throw an exception or deploy some code with a syntax error.

I am deploying NodeJS AWS Lambda functions and SentryNodeServerlessSDK is registered as layer.
Here are some logs samples :

throw new Error(‘simulated error’) :

START RequestId: 039c01dd-2698-44cf-ba44-f122a18e372b Version: $LATEST
Error: simulated error
at Object.a (/var/task/functions/status/src/webpack:/sls-ts-template/functions/status/src/handler.ts:18:13)
at /var/task/node_modules/@middy/core/index.js:190:44
at runNext (/var/task/node_modules/@middy/core/index.js:93:14)
at before (/var/task/node_modules/@middy/http-json-body-parser/index.js:24:5)
at runNext (/var/task/node_modules/@middy/core/index.js:78:24)
at runMiddlewares (/var/task/node_modules/@middy/core/index.js:99:3)
at /var/task/node_modules/@middy/core/index.js:173:7
at new Promise (<anonymous>)
at instance (/var/task/node_modules/@middy/core/index.js:159:26)
at /opt/nodejs/node_modules/@sentry/serverless/src/awslambda.ts:204:25
END RequestId: 039c01dd-2698-44cf-ba44-f122a18e372b
REPORT RequestId: 039c01dd-2698-44cf-ba44-f122a18e372b	Duration: 133.17 ms	Billed Duration: 134 ms	Memory Size: 1024 MB	Max Memory Used: 86 MB	Init Duration: 371.66 ms

syntax error :

START RequestId: 097b8f1a-6616-4f56-a5e2-a5541a2734ec Version: $LATEST
2021-04-17T10:30:56.407Z	undefined	ERROR	Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token ';'
    at _loadUserApp (/var/runtime/UserFunction.js:98:13)
    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)
    at Object.<anonymous> (/var/runtime/index.js:43:30)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
2021-04-17T10:30:56.408Z	undefined	ERROR	Uncaught Exception 	
{
    "errorType": "Runtime.UserCodeSyntaxError",
    "errorMessage": "SyntaxError: Unexpected token ';'",
    "stack": [
        "Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token ';'",
        "    at _loadUserApp (/var/runtime/UserFunction.js:98:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:1063:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)",
        "    at Module.load (internal/modules/cjs/loader.js:928:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:769:14)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)",
        "    at internal/main/run_main_module.js:17:47"
    ]
}

END RequestId: 097b8f1a-6616-4f56-a5e2-a5541a2734ec

Am I missing some point ?
Thanks in advance for your help,
best regards
Romain

I had to manually install the SDK in my lambda’s code in order to have the errors logged in Sentry issues dashboard.

I probably misread the documentation.

Issue closed :slight_smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.