From 2049778aab343f7292e956eb2c179236f7a8965b Mon Sep 17 00:00:00 2001 From: Sarah Mischinger Date: Thu, 13 Nov 2025 09:24:43 +0100 Subject: [PATCH] update Deno quick start guide --- .../javascript/guides/deno/index.mdx | 123 ++++++++++++------ .../javascript.deno.mdx | 13 ++ .../javascript.deno.mdx | 7 + .../javascript.deno.mdx | 7 + 4 files changed, 113 insertions(+), 37 deletions(-) create mode 100644 platform-includes/getting-started-features-expandable/javascript.deno.mdx create mode 100644 platform-includes/getting-started-prerequisites/javascript.deno.mdx create mode 100644 platform-includes/getting-started-verify-locate-data/javascript.deno.mdx diff --git a/docs/platforms/javascript/guides/deno/index.mdx b/docs/platforms/javascript/guides/deno/index.mdx index 5d68948bc69ab..9198844a3c363 100644 --- a/docs/platforms/javascript/guides/deno/index.mdx +++ b/docs/platforms/javascript/guides/deno/index.mdx @@ -1,5 +1,6 @@ --- title: Deno +description: Learn how to manually set up Sentry in your Deno app and capture your first errors. sdk: sentry.javascript.deno categories: - javascript @@ -10,31 +11,44 @@ categories: - The Deno SDK is currently in Beta. +This SDK is currently in **beta**. Beta features are still in progress and may have bugs. Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns -The minimum supported Deno version is 2. - -## Configure +## Step 1: Install -Configuration should happen as early as possible in your application's lifecycle. +Choose the features you want to configure, and this guide will show you how: + -In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). + -Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below. +### Import the Sentry SDK - +Import the Sentry Deno SDK directly from the npm registry, before importing any other modules: -```javascript {tabTitle: Deno} +```javascript {filename: main.ts} import * as Sentry from "npm:@sentry/deno"; +// your other imports +``` + +## Step 2: Configure + +### Initialize the Sentry SDK + +Initialize Sentry as early as possible in your app: + +```javascript {filename: main.ts} +import * as Sentry from "npm:@sentry/deno"; +// your other imports Sentry.init({ dsn: "___PUBLIC_DSN___", - + // Adds request headers and IP for users, for more info visit: // https://docs.sentry.io/platforms/javascript/guides/deno/configuration/options/#sendDefaultPii sendDefaultPii: true, @@ -47,56 +61,91 @@ Sentry.init({ // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate tracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance + // ___PRODUCT_OPTION_START___ logs + + // Enable logs to be sent to Sentry + enableLogs: true, + // ___PRODUCT_OPTION_END___ logs }); ``` -```javascript {tabTitle: npm} -import * as Sentry from "@sentry/deno"; +### Enable Network Access -Sentry.init({ - dsn: "___PUBLIC_DSN___", - // ___PRODUCT_OPTION_START___ performance - - // Set tracesSampleRate to 1.0 to capture 100% - // of transactions for performance monitoring. - // We recommend adjusting this value in production - // Learn more at - // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate - tracesSampleRate: 1.0, - // ___PRODUCT_OPTION_END___ performance -}); -``` -To ensure the SDK can send events, you should enable network access for your -ingestion domain: +To make sure the SDK can send events, enable network access for your Sentry ingestion domain: ```bash deno run --allow-net=___ORG_INGEST_DOMAIN___ index.ts ``` -## Allow access to your source files +### Allow Access to Source Files -To ensure the SDK can include your source code in stack traces, you should enable read access for your source files: +Grant read access to your source files so that the SDK can include your source code in stack traces: ```bash deno run --allow-read=./src index.ts ``` -## Verify +## Step 3: Add Readable Stack Traces With Source Maps (Optional) + + -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. +## Step 4: Verify Your Setup -Verify your setup by adding the following snippet anywhere in your code and running it: +Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project. + +### 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, which will call an undefined function, triggering an error that Sentry will capture: ```javascript setTimeout(() => { - throw new Error(); + try { + foo(); + } catch (e) { + Sentry.captureException(e); + } +}, 99); +``` + + +### 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 +Sentry.startSpan({ + op: "test", + name: "My First Test Transaction", +}, () => { + setTimeout(() => { + try { + foo(); + } catch (e) { + Sentry.captureException(e); + } + }, 99); }); ``` + - +### View Captured Data in Sentry -Learn more about manually capturing an error or message in our Usage documentation. +Finally, head over to your project on [Sentry.io](https://sentry.io/) to view the collected data (it takes a couple of moments for the data to appear). - + + +## Next Steps + +At this point, you should have integrated Sentry into your Deno application and should already be sending data to your Sentry project. + +Now's a good time to customize your setup and look into more advanced topics. Our next recommended steps for you are: + +- Extend Sentry to your frontend using one of our [frontend SDKs](/) +- Learn how to manually capture errors +- Continue to customize your configuration +- Get familiar with [Sentry's product features](/product) like tracing, insights, and alerts + + + +- Find various topics in Troubleshooting +- [Get support](https://sentry.zendesk.com/hc/en-us/) -To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + diff --git a/platform-includes/getting-started-features-expandable/javascript.deno.mdx b/platform-includes/getting-started-features-expandable/javascript.deno.mdx new file mode 100644 index 0000000000000..24c6ca4523b0b --- /dev/null +++ b/platform-includes/getting-started-features-expandable/javascript.deno.mdx @@ -0,0 +1,13 @@ + + +- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors, + uncaught exceptions, and unhandled rejections. If you have something that + looks like an exception, Sentry can capture it. +- [**Tracing**](/product/tracing): Track software performance while seeing the + impact of errors across multiple systems. For example, distributed tracing + allows you to follow a request from the frontend to the backend and back. +- [**Logs**](/product/explore/logs): Centralize and analyze your application logs to + correlate them with errors and performance issues. Search, filter, and + visualize log data to understand what's happening in your applications. + + diff --git a/platform-includes/getting-started-prerequisites/javascript.deno.mdx b/platform-includes/getting-started-prerequisites/javascript.deno.mdx new file mode 100644 index 0000000000000..ceb8920ff89a1 --- /dev/null +++ b/platform-includes/getting-started-prerequisites/javascript.deno.mdx @@ -0,0 +1,7 @@ +## Prerequisites + +You need: + +- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/) +- Your application up and running +- Deno version >= `2.0.0` diff --git a/platform-includes/getting-started-verify-locate-data/javascript.deno.mdx b/platform-includes/getting-started-verify-locate-data/javascript.deno.mdx new file mode 100644 index 0000000000000..2aeda41f6656d --- /dev/null +++ b/platform-includes/getting-started-verify-locate-data/javascript.deno.mdx @@ -0,0 +1,7 @@ + + +1. Open the [**Issues**](https://sentry.io/issues) page and select an error from the issues list to view the full details and context of this error. For more details, see this [interactive walkthrough](/product/sentry-basics/integrate-frontend/generate-first-error/#ui-walkthrough). +2. Open the [**Traces**](https://sentry.io/explore/traces) page and select a trace to reveal more information about each span, its duration, and any errors. For an interactive UI walkthrough, click [here](/product/sentry-basics/distributed-tracing/generate-first-error/#ui-walkthrough). +3. Open the [**Logs**](https://sentry.io/explore/logs) page and filter by service, environment, or search keywords to view log entries from your application. For an interactive UI walkthrough, click [here](/product/explore/logs/#overview). + +