newrelic/serverless-newrelic-lambda-layers

New-Relic-Lambda-wrapper not found

arleyyap opened this issue · 4 comments

Lambda calls fail on AWS cloudwatch with the following error:

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'newrelic-lambda-wrapper'\nRequire stack:\n- /var/runtime/index.mjs",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'newrelic-lambda-wrapper'",
        "Require stack:",
        "- /var/runtime/index.mjs",
        "    at _loadUserApp (file:///var/runtime/index.mjs:951:17)",
        "    at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:976:21)",
        "    at async start (file:///var/runtime/index.mjs:1137:23)",
        "    at async file:///var/runtime/index.mjs:1143:1"
    ]
}

I'm using the following configuration

serverless-newrelic-lambda-layers = 3.3.5
version node = 16.16.0

Testing version 3.1.1 doesn't show the error but this version does not support nodejs 16 (Nodejs 16 is necessary for the project).
Doing an internet search, I found the following.

Somebody could help me ?

@arleyyap It looks as though your handler file is in a custom path of the Lambda environment. Is there a reason not to have your handler in the default /var/task?

I'd suggest opening a GTS ticket so that GTS can go over your basic config/environment variables.

@arleyyap #275 might be related to your problem.

Closing, as this ticket hasn't had responses in over a year.