Skip to content

GraphQL Integration in AWS Lambda doesn't instrument resolvers #16092

@nickygb

Description

@nickygb

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/aws-serverless

SDK Version

9.13.0

Framework Version

AWS Lambda with Apollo Server GraphQL

Link to Sentry event

https://bilderit.sentry.io/traces/trace/b5502b4f9cda4cdfb8e0286b5873f33f/?environment=pr1698&mode=samples&node=span-c9ad754030442f47&node=txn-5a2233ef49234b2cb542307b65cabffa&pageEnd&pageStart&project=5261508&source=traces&statsPeriod=1h&table=trace&timestamp=1744911566.867

Reproduction Example/SDK Setup

Sentry.init({
  dsn: 'MY_DSN',
  release: 'MY_RELEASE',
  environment: 'MY_ENVIRONMENT',
  tracesSampleRate: 0.1,
  profilesSampleRate: 0.1,
  debug: true,
  integrations: [
    Sentry.rewriteFramesIntegration({ root: process.cwd() }),
    Sentry.graphqlIntegration({
      ignoreResolveSpans: false,
      useOperationNameForRootSpan: true,
      ignoreTrivialResolveSpans: false,
    }),
    Sentry.knexIntegration(),
    Sentry.postgresIntegration(),
    nodeProfilingIntegration(),
  ],
});

Steps to Reproduce

  1. Set up an AWS Lambda function with Apollo Server GraphQL
  2. Configure Sentry with GraphQL integration as shown above
  3. Make GraphQL requests to the Lambda function
  4. Check Sentry for traces

Expected Result

  1. GraphQL nested resolvers should be instrumented and appear as spans in the trace

Actual Result

  1. Only graphql.parse spans are created, no resolver spans appear

Additional Information

I've noticed that while the GraphQL integration is installed and appears to be patching the GraphQL module, it's not properly instrumenting resolver functions in the AWS Lambda environment. This seems to be related to issue #15699, but specifically focuses on the resolver instrumentation not working at all.

The logs show that the GraphQL parser is being instrumented, but no spans are created for resolvers despite setting ignoreResolveSpans: false.

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