Description
We have this setup in a next.js 14 page router application:
https://github.com/newrelic/newrelic-node-examples/blob/9415503f3bd78fa5d87a7214596d51c946199474/nextjs/nextjs-legacy/pages/_document.jsx
if (newrelic.agent.collector.isConnected() === false) {
await new Promise((resolve) => {
newrelic.agent.on("connected", resolve)
})
}
After upgrading from version 13.2.1 to 13.4.0 we started getting this error
TypeError: Cannot read properties of undefined (reading 'collector') at....
Seems like the new relic agent is undefined?
Expected Behavior
We expect to be able to check if the agent is connected or not and according to documentation we should not need any null checks
Steps to Reproduce
Set up for next.js with page router according to examples.
Your Environment
Node version: 22
Version: between 13.2.1 and 13.4.0