Description
Description
Originally posted in this comment by @rowbot-weisguy
@relm923 good point. We use CDK so I've been bundling it using
esbuild
viaaws-cdk-lib/aws-lambda-nodejs
.Today, given your advice, I set up a separate layer and marked
express
as an external module. It works! Warning is gone and I managed to get traces that I wanted to see from the lambda as long as I explicitly include the integrations I care about (e.g.expressIntegration
,redisIntegration
, andpostgresIntegration
).I'm still noticing the generated issue titles (span names?) are a little unhelpful.
In development, using
@sentry/node
I see:Lovely! The path is so helpful to know immediately. Whereas in deployed lambdas, using
@sentry/aws-serverless
I see:So I tried implementing your suggestion @andreiborza:
// instrument.lambda.ts import * as Sentry from "@sentry/aws-serverless"; import { nodeProfilingIntegration } from "@sentry/profiling-node"; import { env } from "./env"; Sentry.init({ dsn: env.PILOT_API_SENTRY_DSN, defaultIntegrations: false, integrations: [ ...Sentry.getDefaultIntegrations({}).filter( (integration) => !["Aws", "AwsLambda"].includes(integration.name), ), nodeProfilingIntegration(), Sentry.expressIntegration(), Sentry.redisIntegration(), Sentry.postgresIntegration(), ], environment: env.PILOT_API_SENTRY_ENVIRONMENT, tracesSampleRate: Number(env.PILOT_API_SENTRY_TRACING_SAMPLE_RATE), profilesSampleRate: Number(env.PILOT_API_SENTRY_PROFILING_SAMPLE_RATE), }); export const wrapHandler = Sentry.wrapHandler; This change made no visible difference to spans / names, and I'm not sure if there's a different way I should disable the Aws integration.Would love to make sure our Sentry issues are informative at a glance, so please let me know if there's something else I can do here. This is my first time instrumenting Sentry w/ Express & Lambda, so I have no experience with previous versions to share.
Metadata
Metadata
Assignees
Type
Projects
Status