Skip to content

docs(js): Review and update Fastify quick start guide #14249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/platforms/javascript/guides/fastify/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Fastify
description: "This guide explains how to set up Sentry in your Fastify application."
description: "Learn how to manually set up Sentry in your Fastify app and capture your first errors."
sdk: sentry.javascript.node
fallbackGuide: javascript.node
categories:
Expand Down
27 changes: 27 additions & 0 deletions platform-includes/getting-started-verify/javascript.fastify.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
### Issues

First, let's verify that Sentry captures errors and creates issues in your Sentry project. Add the following code snippet to your main application file that defines a route that triggers an error when called:

```javascript
app.get("/debug-sentry", function mainHandler(req, res) {
throw new Error("My first Sentry error!");
});
```

<OnboardingOption optionId="performance">

### Tracing

To test your tracing configuration, update the previous code snippet by starting a trace to measure the time it takes for the execution of your code:

```javascript
app.get("/debug-sentry", async function mainHandler(request, reply) {
await Sentry.startSpan(
{
op: "test",
name: "My First Test Transaction",
},
async () => {
await new Promise((resolve) => setTimeout(resolve, 100)); // Wait for 100ms
throw new Error("My first Sentry error!");
}
);
});
```

</OnboardingOption>