# Get started with Error Tracking

Create a project, send a test error from Node.js with the official Sentry SDK, open the issue it becomes, and delete the project again.

This takes about ten minutes. Replace _my-app_ with a name of your own, _project-id_ with the
project's id and _issue-id_ with the issue's short id.

## Prerequisites

- Permission for `errors:CreateProject`, `errors:ListProjects`, `errors:ListIssues`,
  `errors:GetEvents` and `errors:DeleteProject`. In the console, **Projects** shows an
  access-denied notice without `errors:ListProjects`, a project's pages are not found without it
  on that project, the **Issues** tab says "You cannot see this project's issues." without
  `errors:ListIssues`, and an issue's page says "You can see this issue but not its events."
  without `errors:GetEvents`.
- Node.js and npm, to send the test error with the official Sentry SDK for Node.js.

## Step 1: Create a project

**Console**
1. In Error Tracking, open **Projects**, then choose **Create project**.
2. For **Name**, enter my-app.
3. For **Platform**, choose **Node.js**.
4. Choose **Create**.

The console opens the project's **Setup** tab. Copy the DSN from the page header.

**CLI**
```sh
dcloud errors projects create --name my-app --platform node
```

The answer carries the project's `id` and `dsn`.

**API**
```http
POST /errors/api/projects
{ "name": "my-app", "platform": "node" }
```

The answer is `201` with the project, its `id` and its `dsn`.

## Step 2: Send a test error

In an empty directory, install the SDK and send one error. Replace _dsn_ with the DSN.

```sh
npm install @sentry/node
cat > send.mjs <<'EOF'
import * as Sentry from '@sentry/node';
Sentry.init({ dsn: process.env.SENTRY_DSN });
Sentry.captureException(new Error('Hello from my-app'));
await Sentry.flush(2000);
EOF
SENTRY_DSN='dsn' node send.mjs
```

## Step 3: Open the issue

**Console**
1. Open the project, then the **Issues** tab.
2. Choose the issue _Error: Hello from my-app_ (an issue's title is the exception's type and
   message).

The issue page shows the event with its stack trace and tags.

**CLI**
```sh
dcloud errors issues list project-id
dcloud errors events latest issue-id
```

**API**
```http
GET /errors/api/projects/project-id/issues
```

```http
GET /errors/api/issues/issue-id/events/latest
```

## Clean up

Deleting the project revokes its DSN keys and deletes its issues and events.

**Console**
1. Open the project's **Settings** tab.
2. Under **Danger zone**, choose **Delete project**, enter the project's name and confirm.

**CLI**
```sh
dcloud errors projects delete project-id
```

**API**
```http
DELETE /errors/api/projects/project-id
```

## Next steps

- [Connect an app](connect-an-app.md), so a deployed app gets its DSN without copying it.
- [Upload source maps](upload-source-maps.md)
- [Set the default alerts](set-default-alerts.md)
