Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.11.0] breaking change introduced resulting in failure in @newrelic/apollo-server-plugin #2903

Closed
jlowcs opened this issue Jan 24, 2025 · 4 comments

Comments

@jlowcs
Copy link

jlowcs commented Jan 24, 2025

I cannot bump newrelic from 12.8.0 to 12.11.2 because it's now incompatible with @newrelic/apollo-server-plugin

Description

A breaking change was introduced by #2646 (here) which resulted in @newrelic/apollo-server-plugin throwing a undefined error.

TypeError: Cannot read properties of undefined (reading 'measure')
    at createMetricPairs (/node_modules/@newrelic/apollo-server-plugin/lib/common.js:116:17)
    at recordOperationSegment (/node_modules/@newrelic/apollo-server-plugin/lib/common.js:111:3)
    at Transaction.record (/node_modules/newrelic/lib/transaction/index.js:680:23)
    at Transaction.end (/node_modules/newrelic/lib/transaction/index.js:212:10)
    at ServerResponse.instrumentedFinish (/node_modules/newrelic/lib/instrumentation/core/http.js:207:15)
    at <anonymous> (/node_modules/@opentelemetry/context-async-hooks/src/AbstractAsyncHooksContextManager.ts:75:49)
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
    at SentryContextManager.with (/node_modules/@opentelemetry/context-async-hooks/src/AsyncLocalStorageContextManager.ts:40:36)
    at SentryContextManager.with (/node_modules/@sentry/opentelemetry/src/contextManager.ts:71:24)
    at ServerResponse.contextWrapper (/node_modules/@opentelemetry/context-async-hooks/src/AbstractAsyncHooksContextManager.ts:75:26)
    at Object.onceWrapper (node:events:632:28)
    at ServerResponse.emit (node:events:530:35)
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
    at AsyncLocalContextManager.runInContext (/node_modules/newrelic/lib/context-manager/async-local-context-manager.js:58:38)
    at ServerResponse.wrapped [as emit] (/node_modules/newrelic/lib/transaction/tracer/index.js:250:37)
    at onFinish (node:_http_outgoing:1077:10)
    at callback (node:internal/streams/writable:766:21)
    at afterWrite (node:internal/streams/writable:710:5)
    at afterWriteTick (node:internal/streams/writable:696:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:89:21)

Expected Behavior

A minor bump probably should not introduce a breaking change in an API used by other libraries.

Steps to Reproduce

Run an apollo server with @newrelic/apollo-server-plugin 6.0.0 and newrelic 12.11.2

@workato-integration
Copy link

@bizob2828
Copy link
Member

bizob2828 commented Jan 24, 2025

@jlowcs I'm sorry you hit this issue. You'll either have to upgrade Apollo plugin to latest(7.0.0) or pin agent to 12.10.0. The change you reference isn't a public interface, however this package is accessing internals. We do have plans in our next major release to fold this instrumentation into the agent to avoid future issues like this

@jlowcs
Copy link
Author

jlowcs commented Jan 24, 2025

@jlowcs you'll either have to upgrade Apollo plugin to latest or pin agent to 12.10.0

Oh, my bad, I thought we were on 7.0.0 already for @newrelic/apollo-server-plugin, but we're still on 6.0.0. I'll try bumping both.

@bizob2828
Copy link
Member

@jlowcs it's totally understandable. We've created tightly coupled packages. Which is why we have already folded in a few other standalone instrumentation packages during the past year(@newrelic/aws-sdk, @newrelic/koa, @newrelic/next, and @newrelic/superagent). I'm going to close this issue

@github-project-automation github-project-automation bot moved this from Triage Needed: Unprioritized Features to Done: Issues recently completed in Node.js Engineering Board Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done: Issues recently completed
Development

No branches or pull requests

2 participants