Closed peterabbott closed 10 months ago
Guess it was not picked up in testing because of this one https://github.com/elastic/apm-agent-nodejs/issues/3719
Managed to recreate locally with out test harness. It is this line here does not take into account that that message attributes might be undefined. The AWS type has it optional
error: TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at /XXXXXXXXXXX/elastic-apm-node/lib/instrumentation/modules/@aws-sdk/client-sqs.js:72:39
Hi @peterabbott
Thanks for reporting the issue and provide a diagnose :)
The instrumentation is checking for MessageAttributes
being defined on SendMessage
command
if (commandName === 'SendMessage' && input.MessageAttributes)
For SendMessageBatch
command is checking that Entries
property is an array but not that the items inside are defined so I think this is where undefined
s are coming from.
I'll start working with the fix today
@peterabbott fix is available in latest release (v4.2.0). Thanks again for filing the issue :)
Describe the bug
To Reproduce
Using 4.1.0 of the agent. When publishing usign the SQS client and APM enabled, without any modifications.
Getting error following error. Not been able to get nested error out yet.
The only different between the versions 4.0.0 and 4.1.0 is the introduction of aws-sqs instrumentation. Will post more details if we get anything out of the nested error. For now we can disable aws instrumentations to avoid renovate doignan auto bump again and breaking things.
Expected behavior
Environment (please complete the following information)
How are you starting the agent? (please tick one of the boxes)
agent.start()
directly (e.g.require('elastic-apm-node').start(...)
)elastic-apm-node/start
from within the source code-r elastic-apm-node/start
Additional context
Agent config options:
Click to expand
``` { ...baseConfig, // leaving these in to support using with lambda-executor for local testing serviceName: appName, active: process.env.NODE_ENV === 'production', disableInstrumentations: [], environment: environment + '-' + zone, globalLabels: { deployEnvironment: environment, zoneName: zone, serviceName: appName } } ```package.json
dependencies:Click to expand
``` "elastic-apm-node": "4.1.0" ```