---
title: Troubleshoot Lambda monitoring
source: https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/troubleshooting/troubleshoot-enabling-serverless-monitoring-aws-lambda
---

## Problem

You're attempting to enable [serverless monitoring for AWS Lambda](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/introduction-lambda) and are having an issue or error.

## Solution

There are two common problems related to not completing all of the [enablement procedures](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/introduction-lambda/#link):

-   Not seeing data on **Lambda metrics** UI page. This means the [AWS integration step](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/introduction-lambda/#link) wasn't completed.
-   Not seeing data on **Troubleshooting** category UI pages. If you aren't seeing data on the **Distributed tracing**, **Errors**, and **Invocations** UI tabs, this means the [APM agent instrumentation step](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/introduction-lambda/#instrument) wasn't completed.

Besides these basic enablement problems, there are some additional problems that may cause an issue:

-   CloudWatch error "HTTP error 401: unauthorized." This is due to an incorrect API Key. The `--nr-api-key`argument in the [Configure AWS enable step](https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/instrument-lambda-function/introduction-lambda/#link) takes your user key.
-   Custom metrics are missing. Lambda monitoring is not compatible with our [custom metrics](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/collect-custom-metrics). Use [custom attributes](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/collect-custom-attributes) to add metadata.
-   Invocations tab missing. With APM + Serverless Convergence, each Lambda invocation corresponds to the Transaction trace in APM. To see invocation breakdown details, refer to [Transaction traces](https://docs.newrelic.com/docs/apm/apm-ui-pages/monitoring/transactions-page-find-specific-performance-problems).
-   You've completed the installation, integration, and instrumentation steps correctly, and your function is sending logs to CloudWatch but you're not seeing traces for specific dependencies (or any traces) in the UI. This may result from the order of layer merging (if you're using our Lambda layers) or from the order of import (if you're instrumenting manually):

    -   If you're instrumenting with layers: make sure in your function configuration that the New Relic layer is merged before other layers (though if your function uses webpack, the New Relic layer should be merged after the webpack layer).
    -   If you're instrumenting a Node.js function manually, make sure that [logging is enabled](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration/#logging_config), and that your function imports **newrelic** before it imports any dependencies you expect to monitor.
    -   If you're using ES Modules with a Node.js function, make sure to change the handler function to `/opt/nodejs/node_modules/newrelic-esm-lambda-wrapper/index.handler`. Additionally, set the environment variable of `NODE_PATH` to `--experimental-loader newrelic/esm-loader.mjs`.

If none of these solutions help you, contact our [support team](https://support.newrelic.com/). The following information will help you when you talk to support technicians:

-   Has the Lambda function appeared in the UI before? If so, what is the name of the function?
-   If some data for the Lambda function is appearing in the UI, what specific data is appearing?
-   What APM language agent are you using to instrument the function?

**Recommended: Attach your CloudWatch logs to the ticket**

To provide our support team with logging information when opening a ticket:

1.  Invoke the function in AWS Lambda.
2.  Click on the **logs** link after your function runs.
3.  This will take you to the CloudWatch logs in AWS. On the left-hand sidebar in AWS, under **Logs**, click on **Insights.**
4.  Select your **function** and also the **newrelic-log-ingestion** stream.
5.  Apply an appropriate **Time Filter**, and a log entry **limit** (the default of 20 may not be enough).
6.  Under **Actions** select **Copy query results (ASCII)**.
7.  Paste the copied text into a new text file, then **save and upload the text file to the ticket.**

    > #### ⚠️ IMPORTANT
    >
    > The NR_LAMBDA_MONITORING payload contains all the information the agent attempts to send up, including metrics, events, some AWS account metadata, invocations and errors data. Note that some of that data (for example, our legacy metrics) will not make it to our UI because our ingest pipeline does not consume them.
