Closed mintavenger closed 8 months ago
@mintavenger Have you set the NEW_RELIC_USE_ESM
environment variable for your function to true
? ESM instrumentation requires a separate loading path, which is triggered by that env var. That's mentioned in the README for the Lambda layers: https://github.com/newrelic/newrelic-lambda-layers?tab=readme-ov-file#support-for-es-modules-nodejs
Thanks @mrickard for the link. I added NEW_RELIC_USE_ESM
and I still get the error:
2024-01-30T18:16:04.143Z undefined ERROR Uncaught Exception
{
"errorType": "Error",
"errorMessage": "Unable to resolve module file at /var/task/nextjssite-index with the following extensions: .cjs,.js",
"stack": [
"Error: Unable to resolve module file at /var/task/nextjssite-index with the following extensions: .cjs,.js",
" at getFullyQualifiedModulePath (/opt/nodejs/node_modules/newrelic-lambda-wrapper/index.js:59:11)",
" at getModuleWithRequire (/opt/nodejs/node_modules/newrelic-lambda-wrapper/index.js:82:26)",
" at getHandlerSync (/opt/nodejs/node_modules/newrelic-lambda-wrapper/index.js:127:23)",
" at Object.<anonymous> (/opt/nodejs/node_modules/newrelic-lambda-wrapper/index.js:116:46)",
" at Module._compile (node:internal/modules/cjs/loader:1256:14)",
" at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)",
" at Module.load (node:internal/modules/cjs/loader:1119:32)",
" at Module._load (node:internal/modules/cjs/loader:960:12)",
" at Module.require (node:internal/modules/cjs/loader:1143:19)",
" at require (node:internal/modules/cjs/helpers:119:18)"
]
}
I guess I will try the manual method and apply it to a few select lambdas...
Description
AWS Lambda fails to start with exception with NewRelic layer
Steps to Reproduce
Use Newrelic CLI to install monitoring layer to Lambda function on AWS
Expected Behaviour
Metrics to appear and lambdas to execute
Relevant Logs / Console output
Your Environment
Additional context