> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AppSignal for Node.js: Diagnose tool

The AppSignal Node.js package ships with a self-diagnostic tool. This tool can be used to debug your AppSignal installation and is one of the first things our support team asks for when there's an issue.

## The diagnostic report

This command-line tool is useful when testing AppSignal on a system and validating the local configuration. It outputs useful information to debug issues and it checks if AppSignal agent can run on the machine's architecture and communicate with the AppSignal servers.

This diagnostic tool collects and outputs the following:

* information about the AppSignal package.
* information about the host system and Node.js.
* if the AppSignal [extension](/appsignal/how-appsignal-operates#extension) and [agent](/appsignal/how-appsignal-operates#agent) can run on the host system.
* all configured config options (including default values).
* if the configuration is valid and active.
* if the Push API key is present and valid (internet connection required).
* where configuration option values originate from.

Read more about how to use the diagnose command on the [Debugging][debugging] page.

## Submitting the report

You need to pass the `--send-report` option to send the diagnose report to AppSignal. If used, the report will be send to our servers and you will receive a support token.

When you [send this support token to us](mailto:support@appsignal.com) we will review the report and help you debug the issue. We've seen that copy-pasting the report output usually loses formatting and makes it harder to read, which is why it's sent to our servers in the JSON format.

## Usage

On the command line in your project (a directory with a `package.json` and `@appsignal/nodejs` installed) run:

<CodeGroup>
  ```bash Bash theme={null}
  npx @appsignal/cli diagnose
  ```
</CodeGroup>

At the very least, the `APPSIGNAL_PUSH_API_KEY` must be set before the diagnose command can be run. If this isn't set in your environment already, you can also set it at runtime with the `--api-key` option:

<CodeGroup>
  ```bash Bash theme={null}
  npx @appsignal/cli diagnose --api-key="<PUSH API KEY HERE>"
  ```
</CodeGroup>

You can also set the environment variable at runtime:

<CodeGroup>
  ```bash Bash theme={null}
  APPSIGNAL_PUSH_API_KEY="<PUSH API KEY HERE>" npx @appsignal/cli diagnose
  ```
</CodeGroup>

To run the diagnose on your production server, and send the report to AppSignal for support purposes, you can run the following command:

<CodeGroup>
  ```bash Bash theme={null}
  npx @appsignal/cli diagnose --environment=production --send-report --api-key="<PUSH API KEY HERE>"
  ```
</CodeGroup>

The environment option is useful when the default environment is not the one you want to diagnose. The diagnose tool will warn you when no environment is selected.

## Options

| Option                                               | Description                                                                |
| ---------------------------------------------------- | -------------------------------------------------------------------------- |
| [`--environment=<environment>`](#environment-option) | Set the environment to use in the command, e.g. `production` or `staging`. |
| `--api-key`                                          | Define which API key to use.                                               |
| [`--[no-]send-report`](#report-submission-option)    | Automatically send, or do not send the report.                             |

### Environment option

Define which app environment AppSignal should load in the diagnose CLI.

<CodeGroup>
  ```bash Bash theme={null}
  npx @appsignal/cli diagnose --environment=production
  ```
</CodeGroup>

### Report submission option

The options to [submit the report](#submitting-the-report) immediately, or not, were added to the AppSignal Node.js package version `1.2.5`.

Submit the report to AppSignal:

<CodeGroup>
  ```bash Bash theme={null}
  npx @appsignal/cli diagnose --send-report
  ```
</CodeGroup>

Do not submit the report to AppSignal:

<CodeGroup>
  ```bash Bash theme={null}
  npx @appsignal/cli diagnose --no-send-report
  ```
</CodeGroup>

## Configuration output format

### Configuration option values format

The configuration options are printed to the CLI as their inspected values. This means we print them as Node.js would in a console.

* Strings values are printed with double quotes around them, e.g. `"My app name"`.
* Booleans values are printed as their raw values: `true` and `false`.
* Arrays values are printed as a collection of values surrounded by square brackets, e.g. `["HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET"]`.
  * Empty Arrays are printed as two square brackets: `[]`.
* Null or undefined values are printed as `null` or `undefined`.

[debugging]: /support/debugging.html
