elastic / elastic/apm-agent-nodejs
"message" should be excluded from error.exception.attributes
- Dominant language
- JavaScript
- Stars
- 594
- Forks
- 244
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 16
Description
Here is an error event that was sent to APM server from some of my playing with DynamoDB:
```
{
"error": {
"id": "c273134654769155f620f5cd0208fdeb",
"timestamp": 1625088024162000,
"parent_id": "492af10eb96b0cc1",
"trace_id": "9be9218aa7b0c51f177a692e055ab7d9",
"transaction_id": "5bb5597c72ebcc85",
"transaction": {
"type": null,
"sampled": true
},
"context": {
"user": {},
"tags": {},
"custom": {}
},
"exception": {
"message": "There were 40 validation errors:\n* InvalidParameterType: Expected params.ExpressionAttributeValues[':artist'] to be a structure\n* UnexpectedParameter: Unexpected key '0' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '1' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '2' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '3' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '4' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '5' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '6' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '7' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '8' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '9' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '10' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '11' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '12' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '13' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '14' found in params.ExpressionAttributeValues[':artist']\n* InvalidParameterType: Expected params.ExpressionAttributeValues[':songTitle'] to be a structure\n* UnexpectedParameter: Unexpected key '0' found in params.ExpressionAttributeValues[':songTitle']\n* UnexpectedParameter: Unexpected key '1' found in params.ExpressionAttributeValues[':songTitle']\n* UnexpectedParameter: Unexpected key '2' found in params.ExpressionAttributeValues[':songTitle']\n* UnexpectedParameter: Unexpected key '3' found in params.ExpressionAttributeValues[':songTitle']\n",
"type": "MultipleValidationErrors",
"handled": true,
"code": "MultipleValidationErrors",
"attributes": {
"message": "There were 40 validation errors:\n* InvalidParameterType: Expected params.ExpressionAttributeValues[':artist'] to be a structure\n* UnexpectedParameter: Unexpected key '0' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '1' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '2' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '3' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '4' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '5' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '6' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '7' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '8' found in params.ExpressionAttributeValues[':artist']\n* UnexpectedParameter: Unexpected key '9'",
"time": "2021-06-30T21:20:24.162Z"
},
"module": "aws-sdk",
"stacktrace": [
{
"filename": "node_modules/aws-sdk/lib/param_validator.js",
"function": "ParamValidator.validate",
"lineno": 40,
"library_frame": true,
"abs_path": "/Users/trentm/el/apm-agent-nodejs12/node_modules/aws-sdk/lib/param_validator.js"
},
{
"filename": "node_modules/aws-sdk/lib/event_listeners.js",
"function": "Request.VALIDATE_PARAMETERS",
"lineno": 132,
"library_frame": true,
"abs_path": "/Users/trentm/el/apm-agent-nodejs12/node_modules/aws-sdk/lib/event_listeners.js"
},
{
"filename": "node_modules/aws-sdk/lib/sequential_executor.js",
"function": "Request.callListeners",
"lineno": 106,
"library_frame": true,
"abs_path": "/Users/trentm/el/apm-agent-nodejs12/node_modules/aws-sdk/lib/sequential_executor.js"
},
{
"filename": "node_modules/aws-sdk/lib/sequential_executor.js",
"function": "callNextListener",
"lineno": 96,
"library_frame": true,
"abs_path": "/Users/trentm/el/apm-agent-nodejs12/node_modules/aws-sdk/lib/sequential_executor.js"
}
]
},
"culprit": "ParamValidator.validate (node_modules/aws-sdk/lib/param_validator.js)"
}
}
```
This was a case of a very long `err.message`. That's fine, but I notice that the message is repeated (with a different truncation length, 1024 instead of 2048) in `error.exception.attributes`. That's redundant. The handling for this is https://github.com/elastic/apm-agent-nodejs/blob/v3.16.0/lib/errors.js#L64-L97 which already excludes `code` because it is redunant with `error.exception.code`.
This errors.js is from a recent overhaul in #2094 so I don't know if this is a regression. From a quick glance at part of the code this was replacing (https://github.com/watson/stackman/blob/8d0381086b2524bb31e7d4145fac1ef5f5e40a73/index.js#L69-L86), I don't think so.
Contributor guide
Assessment
This issue has not been assessed yet.