Skip to content

Local Variables does not work in Apollo GraphQL server running as an Express app #16701

Closed

Activity

  1. self-assigned this
    on Jun 23, 2025
  2. added theissue type on Jun 23, 2025
  3. AbhiPrasad commented on Jun 23, 2025

    @AbhiPrasad
    ContributorAuthor

    From debugging the problem, I think it's because of a mismatch with the detected filename.

    the local variables gives us function X while the frame has function Object.X.

    frames [
      {
        filename: '/Users/abhijeetprasad/customer/mini-graphql/app.js',
        module: 'app',
        function: 'Object.testSentry',
        lineno: 32,
        colno: 14,
        in_app: true,
        debug_id: undefined,
        pre_context: [
          '  }',
          '`;',
          '',
          'const resolvers = {',
          '  Query: {',
          '    testSentry: (args) => {',
          '      try {'
        ],
        context_line: '        args.foo.map((x) => x);',
        post_context: [
          '        return true;',
          '      } catch (error) {',
          '        Sentry.captureException(error);',
          '        return false;',
          '      }',
          '    },',
          '  },'
        ],
        vars: { args: '<undefined>' }
      }
    ]
    localVariables [
      { function: 'testSentry', vars: { args: '<undefined>' } },
      {
        function: 'field.resolve',
        vars: {
          source: '<undefined>',
          args: {},
          contextValue: {},
          info: [Object],
          userFieldResolver: '<undefined>'
        }
      },
      {
        function: 'executeField',
        vars: {
          exeContext: {},
          parentType: '<GraphQLObjectType>',
          source: '<undefined>',
          fieldNodes: [Array],
          path: [Object],
          fieldDef: [Object],
          returnType: '<GraphQLNonNull>',
          info: [Object]
        }
      },
      {
        function: 'executeFields',
        vars: {
          exeContext: {},
          parentType: '<GraphQLObjectType>',
          sourceValue: '<undefined>',
          path: '<undefined>',
          fields: '<Map(1)>',
          results: {},
          containsPromise: false
        }
      },
      {
        function: 'executeOperation',
        vars: {
          exeContext: {},
          operation: [Object],
          rootValue: '<undefined>',
          rootType: '<GraphQLObjectType>',
          rootFields: '<Map(1)>',
          path: '<undefined>'
        }
      },
      {
        function: 'execute',
        vars: {
          args: {},
          schema: '<GraphQLSchema>',
          document: [Object],
          variableValues: '<undefined>',
          rootValue: '<undefined>',
          exeContext: {},
          arguments: '<Arguments(1)>'
        }
      },
      { function: 'executeIncrementally', vars: { args: {} } },
      {
        function: 'process.processTicksAndRejections',
        vars: { tock: '<null>' }
      }
    ]
    
  4. github-actions commented on Jun 25, 2025

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #16702, which was included in the 9.32.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions