newrelic/serverless-newrelic-lambda-layers

TypeError: Cannot read property 'error' of undefined

pavanwashimkar opened this issue · 6 comments

Tried the steps mentioned for integration with new Relic of lambda written in node.js and getting below error.

Plugins: ["serverless-pseudo-parameters","serverless-newrelic-lambda-layers"]

× Stack bamboo-trigger-gui-test-01-dev failed to deploy (21s)
Environment: win32, node 14.20.0, framework 3.26.0, plugin 6.2.2, SDK 4.3.2
Credentials: Local, environment variables
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues

Error:
TypeError: Cannot read property 'error' of undefined
at D:\project\lambda\node_modules\serverless-newrelic-lambda-layers\dist\api.js:31:21
at processTicksAndRejections (internal/process/task_queues.js:95:5)

Can someone please suggest the solution for this error.

Thank you for the report, @pavanwashimkar ! This particular error...may stem from a serverless API change, which we'll look into. But for that error to be triggered, you likely had trouble fetching your New Relic account information. Have you verified that the values of your account ID and API key are correct in your serverless.yml?

Hi All,

Just to update. I have edited the file api.js. Added the logger to check if proxy is causing the issue.
Not sure how but post that the deployment worked.

Added below logger:
console.log("Proxy is :: " + proxy);

@pavanwashimkar I'm not familiar at all with the serverless-pseudo-parameters plugin, but I see that it's deprecated, and not necessary if you're using Serverless beyond version 2.5.0. What happens if you don't use it?

What does your (sanitized) serverless.yml look like?

@pavanwashimkar One other thought: is the API key you're using an ingest key? Or a personal API key? The key required in the serverless.yml should be a personal API key, and not an ingest key.