Skip to content

Issue titles from errors captured with @sentry/aws-serverless differ from @sentry/node #15788

@s1gr1d

Description

@s1gr1d

Description

Originally posted in this comment by @rowbot-weisguy

@relm923 good point. We use CDK so I've been bundling it using esbuild via aws-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, and postgresIntegration).

I'm still noticing the generated issue titles (span names?) are a little unhelpful.

In development, using @sentry/node I see:

Image

Lovely! The path is so helpful to know immediately. Whereas in deployed lambdas, using @sentry/aws-serverless I see:

Image

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.

Image

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

No one assigned

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions