Hello,
We are trying to implement the AWS Lambda agent for APM as per below documentation:
Added below variables:
Defined outbound rules for security groups under 'VPC' section over port 8200
However after firing some requests we are getting this error in Cloudwatch:
{"log.level":"debug","@timestamp":"2022-10-12T14:25:05.451Z","log":{"logger":"elastic-apm-node"},"ecs":{"version":"1.6.0"},"error":{"type":"UserCodeSyntaxError","message":"SyntaxError: Unexpected token { in JSON at position 2955","stack_trace":"Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token { in JSON at position 2955\n at _loadUserApp (/var/runtime/UserFunction.js:218:13)\n at Object.module.exports.load (/var/runtime/UserFunction.js:279:17)\n at Object.<anonymous> (/var/runtime/index.js:43:34)\n at Module._compile (internal/modules/cjs/loader.js:1085:14)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n at Module.load (internal/modules/cjs/loader.js:950:32)\n at Function.Module._load (internal/modules/cjs/loader.js:790:12)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)\n at internal/main/run_main_module.js:17:47"},"message":"Elastic APM caught unhandled exception"}
We have selected node v14.20.0 for Lambda, but we are still having this error. Trace log of the APM module:
{
"log.level": "trace",
"@timestamp": "2022-10-12T14:25:03.563Z",
"log": {
"logger": "elastic-apm-node"
},
"pid": 17,
"ppid": 1,
"arch": "x64",
"platform": "linux",
"node": "v14.20.0",
"agent": "3.38.0",
"startTrace": [
"at Agent.start (/opt/nodejs/node_modules/elastic-apm-node/lib/agent.js:241:11)",
"at Object.<anonymous> (/opt/nodejs/node_modules/elastic-apm-node/start.js:9:32)",
"at Module._compile (internal/modules/cjs/loader.js:1085:14)",
"at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
"at Module.load (internal/modules/cjs/loader.js:950:32)",
"at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
"at Module.require (internal/modules/cjs/loader.js:974:19)",
"at Module._preloadModules (internal/modules/cjs/loader.js:1244:12)",
"at loadPreloadModules (internal/bootstrap/pre_execution.js:475:5)",
"at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:72:3)"
],
"main": "<could not determine>",
"dependencies": "<could not determine>",
"conf": {
"ignoreUrlStr": [],
"ignoreUrlRegExp": [],
"ignoreUserAgentStr": [],
"ignoreUserAgentRegExp": [],
"transactionIgnoreUrlRegExp": [],
"sanitizeFieldNamesRegExp": [
"/^password$/i",
"/^passwd$/i",
"/^pwd$/i",
"/^secret$/i",
"/^.*key$/i",
"/^.*token.*$/i",
"/^.*session.*$/i",
"/^.*credit.*$/i",
"/^.*card.*$/i",
"/^.*auth.*$/i",
"/^set\\x2dcookie$/i",
"/^pw$/i",
"/^pass$/i",
"/^connect\\.sid$/i"
],
"ignoreMessageQueuesRegExp": [],
"abortedErrorThreshold": 25,
"active": true,
"apiRequestSize": 786432,
"apiRequestTime": 10,
"breakdownMetrics": false,
"captureBody": "off",
"captureErrorLogStackTraces": "messages",
"captureExceptions": true,
"captureHeaders": true,
"centralConfig": false,
"cloudProvider": "none",
"contextPropagationOnly": false,
"disableInstrumentations": [],
"disableSend": false,
"environment": "production",
"errorOnAbortedRequests": false,
"exitSpanMinDuration": 0,
"filterHttpHeaders": true,
"ignoreMessageQueues": [],
"instrument": true,
"instrumentIncomingHTTPRequests": true,
"logLevel": "trace",
"logUncaughtExceptions": false,
"longFieldMaxLength": 10000,
"maxQueueSize": 1024,
"metricsInterval": 0,
"metricsLimit": 1000,
"opentelemetryBridgeEnabled": false,
"sanitizeFieldNames": [
"password",
"passwd",
"pwd",
"secret",
"*key",
"*token*",
"*session*",
"*credit*",
"*card*",
"*auth*",
"set-cookie",
"pw",
"pass",
"connect.sid"
],
"serverTimeout": 30,
"sourceLinesErrorAppFrames": 5,
"sourceLinesErrorLibraryFrames": 5,
"sourceLinesSpanAppFrames": 0,
"sourceLinesSpanLibraryFrames": 0,
"spanCompressionEnabled": true,
"spanCompressionExactMatchMaxDuration": 0.05,
"spanCompressionSameKindMaxDuration": 0,
"stackTraceLimit": 50,
"traceContinuationStrategy": "continue",
"transactionIgnoreUrls": [],
"transactionMaxSpans": 500,
"transactionSampleRate": 1,
"useElasticTraceparentHeader": true,
"usePathAsTransactionName": false,
"verifyServerCert": true,
"secretToken": "[REDACTED]",
"serviceName": "[REDACTED]",
"serviceVersion": "$LATEST",
"spanStackTraceMinDuration": -1,
"serverHost": "[REDACTED]",
"serverPort": 8200
},
"ecs": {
"version": "1.6.0"
},
"message": "agent configured correctly"
}
Could you please help me in this matter ?