Skip to content

Commit 39e93b2

Browse files
committed
Update cloudflare config snippets to use jsonc
1 parent f1ff80f commit 39e93b2

File tree

7 files changed

+75
-35
lines changed

7 files changed

+75
-35
lines changed

docs/platforms/javascript/guides/cloudflare/features/d1.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Cloudflare's serverless SQL database with Sentry.
99
```javascript
1010
import * as Sentry from "@sentry/cloudflare";
1111

12-
// env.DB is the D1 DB binding configured in your `wrangler.toml`
12+
// env.DB is the D1 DB binding configured in your `wrangler.toml`/`wrangler.jsonc`
1313
const db = Sentry.instrumentD1WithSentry(env.DB);
1414
// Now you can use the database as usual
1515
await db.prepare("SELECT * FROM table WHERE id = ?").bind(1).run();

docs/platforms/javascript/guides/cloudflare/frameworks/astro.mdx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@ After installing the Sentry Astro SDK, you can now install the Sentry Cloudflare
1111

1212
<PlatformContent includePath="getting-started-install" />
1313

14-
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`. This is because the SDK
14+
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`/`wrangler.jsonc`. This is because the SDK
1515
needs access to the `AsyncLocalStorage` API to work correctly.
1616

17-
```toml {filename:wrangler.toml}
17+
```json {tabTitle:JSON} {filename:wrangler.jsonc}
18+
{
19+
"compatibility_flags": [
20+
"nodejs_compat"
21+
// "nodejs_als"
22+
]
23+
}
24+
```
25+
26+
```toml {tabTitle:Toml} {filename:wrangler.toml}
1827
compatibility_flags = ["nodejs_compat"]
1928
# compatibility_flags = ["nodejs_als"]
2029
```
@@ -30,7 +39,7 @@ export const onRequest = [
3039
dsn: "___PUBLIC_DSN___",
3140
// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
3241
// Learn more at
33-
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
42+
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
3443
tracesSampleRate: 1.0,
3544
})),
3645
// Add more middlewares here

docs/platforms/javascript/guides/cloudflare/frameworks/remix.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,19 @@ Now you can install the Sentry Cloudflare SDK. First, install the SDK with your
2323

2424
<PlatformContent includePath="getting-started-install" />
2525

26-
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`. This is because the SDK
26+
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`/`wrangler.jsonc`. This is because the SDK
2727
needs access to the `AsyncLocalStorage` API to work correctly.
2828

29-
```toml {filename:wrangler.toml}
29+
```json {tabTitle:JSON} {filename:wrangler.jsonc}
30+
{
31+
"compatibility_flags": [
32+
"nodejs_compat"
33+
// "nodejs_als"
34+
]
35+
}
36+
```
37+
38+
```toml {tabTitle:Toml} {filename:wrangler.toml}
3039
compatibility_flags = ["nodejs_compat"]
3140
# compatibility_flags = ["nodejs_als"]
3241
```

docs/platforms/javascript/guides/cloudflare/frameworks/sveltekit.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,19 @@ If you installed the SDK before, make sure that `@sentry/sveltekit` version `9.2
2323

2424
## 2. Cloudflare configuration
2525

26-
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`. This is because the SDK
26+
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`/`wrangler.jsonc`. This is because the SDK
2727
needs access to the `AsyncLocalStorage` API to work correctly.
2828

29-
```toml {filename:wrangler.toml}
29+
```json {tabTitle:JSON} {filename:wrangler.jsonc}
30+
{
31+
"compatibility_flags": [
32+
"nodejs_compat"
33+
// "nodejs_als"
34+
]
35+
}
36+
```
37+
38+
```toml {tabTitle:Toml} {filename:wrangler.toml}
3039
compatibility_flags = ["nodejs_compat"]
3140
# compatibility_flags = ["nodejs_als"]
3241
```

docs/platforms/javascript/guides/cloudflare/index.mdx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Cloudflare
3-
description: 'Official Sentry SDK for Cloudflare Workers and Cloudflare Pages.'
3+
description: "Official Sentry SDK for Cloudflare Workers and Cloudflare Pages."
44
sdk: sentry.javascript.cloudflare
55
categories:
66
- javascript
@@ -11,7 +11,9 @@ categories:
1111

1212
## Install
1313

14-
<OnboardingOptionButtons options={["error-monitoring", "performance", "profiling"]} />
14+
<OnboardingOptionButtons
15+
options={["error-monitoring", "performance", "profiling"]}
16+
/>
1517

1618
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/).
1719

@@ -35,24 +37,23 @@ pnpm add @sentry/cloudflare
3537

3638
Configuration should happen as early as possible in your application's lifecycle.
3739

38-
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`/`wrangler.json`. This is because the SDK
40+
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`/`wrangler.jsonc`. This is because the SDK
3941
needs access to the `AsyncLocalStorage` API to work correctly.
4042

41-
42-
```toml {tabTitle:Toml} {filename:wrangler.toml}
43-
compatibility_flags = ["nodejs_compat"]
44-
# compatibility_flags = ["nodejs_als"]
45-
```
46-
47-
```json {tabTitle:JSON} {filename:wrangler.json}
43+
```json {tabTitle:JSON} {filename:wrangler.jsonc}
4844
{
4945
"compatibility_flags": [
50-
"nodejs_compat",
46+
"nodejs_compat"
5147
// "nodejs_als"
5248
]
5349
}
5450
```
5551

52+
```toml {tabTitle:Toml} {filename:wrangler.toml}
53+
compatibility_flags = ["nodejs_compat"]
54+
# compatibility_flags = ["nodejs_als"]
55+
```
56+
5657
Then you can install the SDK and add it to your project:
5758

5859
You can either setup up the SDK for [Cloudflare Pages](#setup-cloudflare-pages) or [Cloudflare Workers](#setup-cloudflare-workers).
@@ -89,7 +90,7 @@ environment. Note that you can turn off almost all side effects using the respec
8990
import * as Sentry from "@sentry/cloudflare";
9091

9192
export default Sentry.withSentry(
92-
env => ({
93+
(env) => ({
9394
dsn: "___PUBLIC_DSN___",
9495
// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
9596
// Learn more at
@@ -100,7 +101,7 @@ export default Sentry.withSentry(
100101
async fetch(request, env, ctx) {
101102
return new Response("Hello World!");
102103
},
103-
} satisfies ExportedHandler<Env>,
104+
} satisfies ExportedHandler<Env>
104105
);
105106
```
106107

docs/platforms/javascript/guides/hono/index.mdx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ In addition to capturing errors, you can monitor interactions between multiple s
2020

2121
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
2222

23-
<OnboardingOptionButtons options={["error-monitoring", "performance", "profiling"]} />
23+
<OnboardingOptionButtons
24+
options={["error-monitoring", "performance", "profiling"]}
25+
/>
2426

2527
## Setup
2628

@@ -43,12 +45,7 @@ pnpm add @sentry/cloudflare
4345
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`/`wrangler.json`.
4446
This is because the SDK needs access to the `AsyncLocalStorage` API to work correctly.
4547

46-
```toml {tabTitle:Toml} {filename:wrangler.toml}
47-
compatibility_flags = ["nodejs_compat"]
48-
# compatibility_flags = ["nodejs_als"]
49-
```
50-
51-
```json {tabTitle:JSON} {filename:wrangler.json}
48+
```json {tabTitle:JSON} {filename:wrangler.jsonc}
5249
{
5350
"compatibility_flags": [
5451
"nodejs_compat"
@@ -57,6 +54,11 @@ compatibility_flags = ["nodejs_compat"]
5754
}
5855
```
5956

57+
```toml {tabTitle:Toml} {filename:wrangler.toml}
58+
compatibility_flags = ["nodejs_compat"]
59+
# compatibility_flags = ["nodejs_als"]
60+
```
61+
6062
Next, wrap your handler with the `withSentry` function. This will initialize the SDK and hook into the
6163
environment. Note that you can turn off almost all side effects using the respective options.
6264

@@ -101,12 +103,7 @@ pnpm add @sentry/cloudflare
101103
To use the SDK, you'll need to set either the `nodejs_compat` or `nodejs_als` compatibility flags in your `wrangler.toml`/`wrangler.json`.
102104
This is because the SDK needs access to the `AsyncLocalStorage` API to work correctly.
103105

104-
```toml {tabTitle:Toml} {filename:wrangler.toml}
105-
compatibility_flags = ["nodejs_compat"]
106-
# compatibility_flags = ["nodejs_als"]
107-
```
108-
109-
```json {tabTitle:JSON} {filename:wrangler.json}
106+
```json {tabTitle:JSON} {filename:wrangler.jsonc}
110107
{
111108
"compatibility_flags": [
112109
"nodejs_compat"
@@ -115,6 +112,11 @@ compatibility_flags = ["nodejs_compat"]
115112
}
116113
```
117114

115+
```toml {tabTitle:Toml} {filename:wrangler.toml}
116+
compatibility_flags = ["nodejs_compat"]
117+
# compatibility_flags = ["nodejs_als"]
118+
```
119+
118120
Next, add the `sentryPagesPlugin` as
119121
[middleware to your Cloudflare Pages application](https://developers.cloudflare.com/pages/functions/middleware/).
120122

platform-includes/sourcemaps/primer/javascript.cloudflare.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,14 @@ Learn how to unminify your JavaScript code by watching this video or reading the
33

44
<VimeoEmbed id="956055420?h=f428eeda43" />
55

6-
If you are using plain Cloudflare Workers, set `upload_source_maps = true` to your `wrangler.toml` file to enable source map generation.
6+
If you are using plain Cloudflare Workers, set `upload_source_maps = true` to your `wrangler.toml`/`wrangler.jsonc` file to enable source map generation.
7+
8+
```json {tabTitle:JSON} {filename:wrangler.jsonc}
9+
{
10+
"upload_source_maps": true
11+
}
12+
```
13+
14+
```toml {tabTitle:Toml} {filename:wrangler.toml}
15+
upload_source_maps = true
16+
```

0 commit comments

Comments
 (0)