You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: platform-includes/getting-started-config/javascript.cloudflare.mdx
+16-6
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,21 @@
1
-
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
1
+
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
2
2
needs access to the `AsyncLocalStorage` API to work correctly.
3
3
4
-
```toml {filename:wrangler.toml}
4
+
5
+
```toml {tabTitle:Toml} {filename:wrangler.toml}
5
6
compatibility_flags = ["nodejs_compat"]
6
7
# compatibility_flags = ["nodejs_als"]
7
8
```
8
9
10
+
```json {tabTitle:JSON} {filename:wrangler.json}
11
+
{
12
+
"compatibility_flags": [
13
+
"nodejs_compat",
14
+
// "nodejs_als"
15
+
]
16
+
}
17
+
```
18
+
9
19
Then you can install the SDK and add it to your project:
10
20
11
21
You can either setup up the SDK for [Cloudflare Pages](#setup-cloudflare-pages) or
@@ -40,10 +50,10 @@ export const onRequest = [
40
50
To use this SDK, wrap your handler with the `withSentry` function. This will initialize the SDK and hook into the
41
51
environment. Note that you can turn off almost all side effects using the respective options.
42
52
43
-
```javascript
44
-
import*asSentryfrom'@sentry/cloudflare';
53
+
```typescript {filename:index.ts}
54
+
import*asSentryfrom"@sentry/cloudflare";
45
55
46
-
exportdefaultwithSentry(
56
+
exportdefaultSentry.withSentry(
47
57
env=> ({
48
58
dsn: "___PUBLIC_DSN___",
49
59
// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
0 commit comments