@sentry/cloudflare 10.65.0 → 10.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/build/cjs/client.js.map +1 -1
  2. package/build/cjs/durableobject.js +19 -9
  3. package/build/cjs/durableobject.js.map +1 -1
  4. package/build/cjs/flush.js.map +1 -1
  5. package/build/cjs/instrumentations/instrumentSqlStorage.js +5 -0
  6. package/build/cjs/instrumentations/instrumentSqlStorage.js.map +1 -1
  7. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js +89 -8
  8. package/build/cjs/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  9. package/build/cjs/instrumentations/worker/instrumentEnv.js +12 -0
  10. package/build/cjs/instrumentations/worker/instrumentEnv.js.map +1 -1
  11. package/build/cjs/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  12. package/build/cjs/instrumentations/worker/instrumentRateLimit.js +29 -0
  13. package/build/cjs/instrumentations/worker/instrumentRateLimit.js.map +1 -0
  14. package/build/cjs/pages-plugin.js +2 -4
  15. package/build/cjs/pages-plugin.js.map +1 -1
  16. package/build/cjs/request.js.map +1 -1
  17. package/build/cjs/utils/internalSqlQuery.js +19 -0
  18. package/build/cjs/utils/internalSqlQuery.js.map +1 -0
  19. package/build/cjs/utils/isBinding.js +8 -0
  20. package/build/cjs/utils/isBinding.js.map +1 -1
  21. package/build/cjs/workflows.js +11 -5
  22. package/build/cjs/workflows.js.map +1 -1
  23. package/build/cjs/wrapMethodWithSentry.js +4 -4
  24. package/build/cjs/wrapMethodWithSentry.js.map +1 -1
  25. package/build/esm/client.js.map +1 -1
  26. package/build/esm/durableobject.js +19 -9
  27. package/build/esm/durableobject.js.map +1 -1
  28. package/build/esm/flush.js.map +1 -1
  29. package/build/esm/instrumentations/instrumentSqlStorage.js +6 -1
  30. package/build/esm/instrumentations/instrumentSqlStorage.js.map +1 -1
  31. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js +89 -8
  32. package/build/esm/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  33. package/build/esm/instrumentations/worker/instrumentEnv.js +14 -2
  34. package/build/esm/instrumentations/worker/instrumentEnv.js.map +1 -1
  35. package/build/esm/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  36. package/build/esm/instrumentations/worker/instrumentRateLimit.js +27 -0
  37. package/build/esm/instrumentations/worker/instrumentRateLimit.js.map +1 -0
  38. package/build/esm/package.json +1 -1
  39. package/build/esm/pages-plugin.js +2 -4
  40. package/build/esm/pages-plugin.js.map +1 -1
  41. package/build/esm/request.js.map +1 -1
  42. package/build/esm/utils/internalSqlQuery.js +17 -0
  43. package/build/esm/utils/internalSqlQuery.js.map +1 -0
  44. package/build/esm/utils/isBinding.js +7 -1
  45. package/build/esm/utils/isBinding.js.map +1 -1
  46. package/build/esm/workflows.js +11 -5
  47. package/build/esm/workflows.js.map +1 -1
  48. package/build/esm/wrapMethodWithSentry.js +5 -5
  49. package/build/esm/wrapMethodWithSentry.js.map +1 -1
  50. package/build/types/client.d.ts +33 -3
  51. package/build/types/client.d.ts.map +1 -1
  52. package/build/types/durableobject.d.ts.map +1 -1
  53. package/build/types/executionContext.d.ts +13 -0
  54. package/build/types/executionContext.d.ts.map +1 -0
  55. package/build/types/flush.d.ts +3 -2
  56. package/build/types/flush.d.ts.map +1 -1
  57. package/build/types/instrumentations/instrumentSqlStorage.d.ts.map +1 -1
  58. package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts +3 -3
  59. package/build/types/instrumentations/instrumentWorkerEntrypoint.d.ts.map +1 -1
  60. package/build/types/instrumentations/worker/instrumentEnv.d.ts +2 -0
  61. package/build/types/instrumentations/worker/instrumentEnv.d.ts.map +1 -1
  62. package/build/types/instrumentations/worker/instrumentRateLimit.d.ts +6 -0
  63. package/build/types/instrumentations/worker/instrumentRateLimit.d.ts.map +1 -0
  64. package/build/types/pages-plugin.d.ts.map +1 -1
  65. package/build/types/request.d.ts +3 -2
  66. package/build/types/request.d.ts.map +1 -1
  67. package/build/types/utils/internalSqlQuery.d.ts +18 -0
  68. package/build/types/utils/internalSqlQuery.d.ts.map +1 -0
  69. package/build/types/utils/isBinding.d.ts +14 -1
  70. package/build/types/utils/isBinding.d.ts.map +1 -1
  71. package/build/types/workflows.d.ts.map +1 -1
  72. package/build/types/wrapMethodWithSentry.d.ts +5 -0
  73. package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
  74. package/build/types-ts3.8/client.d.ts +33 -3
  75. package/build/types-ts3.8/executionContext.d.ts +13 -0
  76. package/build/types-ts3.8/flush.d.ts +3 -2
  77. package/build/types-ts3.8/instrumentations/instrumentWorkerEntrypoint.d.ts +3 -3
  78. package/build/types-ts3.8/instrumentations/worker/instrumentEnv.d.ts +2 -0
  79. package/build/types-ts3.8/instrumentations/worker/instrumentRateLimit.d.ts +6 -0
  80. package/build/types-ts3.8/request.d.ts +3 -2
  81. package/build/types-ts3.8/utils/internalSqlQuery.d.ts +18 -0
  82. package/build/types-ts3.8/utils/isBinding.d.ts +14 -1
  83. package/build/types-ts3.8/wrapMethodWithSentry.d.ts +5 -0
  84. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
- import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers';
1
+ import { WorkerEntrypoint } from 'cloudflare:workers';
2
2
  import { CloudflareOptions } from '../client';
3
- export type WorkerEntrypointConstructor<Env = typeof cloudflareEnv, Props = {}> = new (ctx: ExecutionContext, env: typeof cloudflareEnv) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;
3
+ export type WorkerEntrypointConstructor<Env = unknown, Props = {}> = new (ctx: ExecutionContext, env: any) => InstanceType<typeof WorkerEntrypoint<Env, Props>>;
4
4
  /**
5
5
  * Instruments a WorkerEntrypoint class to capture errors and performance data.
6
6
  *
@@ -38,5 +38,5 @@ export type WorkerEntrypointConstructor<Env = typeof cloudflareEnv, Props = {}>
38
38
  * );
39
39
  * ```
40
40
  */
41
- export declare function instrumentWorkerEntrypoint<T extends WorkerEntrypointConstructor>(optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined, WorkerEntrypointClass: T): T;
41
+ export declare function instrumentWorkerEntrypoint<Env, Props, T extends InstanceType<typeof WorkerEntrypoint<Env, Props>>, C extends new (ctx: ExecutionContext, env: Env) => T>(optionsCallback: (env: Env) => CloudflareOptions | undefined, WorkerEntrypointClass: C): C;
42
42
  //# sourceMappingURL=instrumentWorkerEntrypoint.d.ts.map
@@ -8,6 +8,8 @@ import { CloudflareOptions } from '../../client';
8
8
  * - Service bindings / JSRPC proxies
9
9
  * - Queue producers (via `send` + `sendBatch` duck-typing)
10
10
  * - R2 Buckets (via `head` + `put` + `createMultipartUpload` duck-typing)
11
+ * - Rate limiters (via `limit` duck-typing)
12
+ * - Workers AI (via `run` + `gateway` + `toMarkdown` duck-typing)
11
13
  *
12
14
  * @param env - The Cloudflare env object to instrument
13
15
  * @param options - Optional CloudflareOptions to control RPC trace propagation
@@ -0,0 +1,6 @@
1
+ import { RateLimit } from '@cloudflare/workers-types';
2
+ /**
3
+ * Wraps a Cloudflare rate limiter binding to create a span on each `limit()` call.
4
+ */
5
+ export declare function instrumentRateLimit<T extends RateLimit>(rateLimit: T, bindingName: string): T;
6
+ //# sourceMappingURL=instrumentRateLimit.d.ts.map
@@ -1,9 +1,10 @@
1
- import { CfProperties, ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types';
1
+ import { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';
2
2
  import { CloudflareOptions } from './client';
3
+ import { ExecutionContextCompat } from './executionContext';
3
4
  interface RequestHandlerWrapperOptions {
4
5
  options: CloudflareOptions;
5
6
  request: Request<unknown, IncomingRequestCfProperties<unknown> | CfProperties<unknown>>;
6
- context: ExecutionContext | undefined;
7
+ context: ExecutionContextCompat | undefined;
7
8
  /**
8
9
  * If true, errors will be captured, rethrown and sent to Sentry.
9
10
  * Otherwise, errors are rethrown but not captured.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) manage their
3
+ * own internal SQLite tables, all namespaced with a `cf_` prefix — e.g. `cf_agents_schedules`,
4
+ * `cf_agent_state`, `cf_ai_chat_stream_chunks`. Queries against them (schedule polling, chat-stream
5
+ * persistence, state bookkeeping) are framework implementation details that otherwise flood traces
6
+ * with dozens of zero-signal `db.query` spans per request. The exact set of tables even varies
7
+ * between framework versions, so we match the reserved prefix rather than an enumerated list.
8
+ *
9
+ * The `cf_` prefix is a reserved convention for framework-managed tables, so user tables should not
10
+ * use it. In case a user table does collide with the prefix, the `durableObjectSqlSpanAllowlist`
11
+ * option lets them opt those tables back into instrumentation.
12
+ *
13
+ * The check operates on the query summary produced by `getSqlQuerySummary` (`{operation} {table} ...`,
14
+ * the same value used as the span name), so table targets are already isolated from the rest of the
15
+ * query.
16
+ */
17
+ export declare function targetsCloudflareInternalTable(querySummary: string | undefined, allowlist?: Array<string | RegExp>): boolean;
18
+ //# sourceMappingURL=internalSqlQuery.d.ts.map
@@ -30,7 +30,7 @@
30
30
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
31
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
32
  */
33
- import { D1Database, DurableObjectNamespace, Queue, R2Bucket } from '@cloudflare/workers-types';
33
+ import { Ai, D1Database, DurableObjectNamespace, Queue, R2Bucket, RateLimit } from '@cloudflare/workers-types';
34
34
  /**
35
35
  * Checks if a value is a JSRPC proxy (service binding).
36
36
  *
@@ -56,9 +56,22 @@ export declare function isQueue(item: unknown): item is Queue;
56
56
  * D1Database has `prepare`, `batch`, and `exec` methods.
57
57
  */
58
58
  export declare function isD1Database(item: unknown): item is D1Database;
59
+ /**
60
+ * Duck-type check for Workers AI bindings.
61
+ * The Ai binding has `run`, `gateway`, and `toMarkdown` methods.
62
+ */
63
+ export declare function isAiBinding(item: unknown): item is Ai;
59
64
  /**
60
65
  * Duck-type check for R2 Bucket bindings.
61
66
  * R2Bucket has `head`, `put`, and `createMultipartUpload` methods.
62
67
  */
63
68
  export declare function isR2Bucket(item: unknown): item is R2Bucket;
69
+ /**
70
+ * Duck-type check for RateLimit bindings.
71
+ * RateLimit only exposes a single `limit` method. Because that is a fairly
72
+ * common method name, this check is intentionally run after the more specific
73
+ * binding checks (Queue, R2, D1) in `instrumentEnv`, so those win when a binding
74
+ * also happens to expose `limit`.
75
+ */
76
+ export declare function isRateLimit(item: unknown): item is RateLimit;
64
77
  //# sourceMappingURL=isBinding.d.ts.map
@@ -20,6 +20,11 @@ type MethodWrapperOptions = {
20
20
  * @default false
21
21
  */
22
22
  startNewTrace?: boolean;
23
+ /**
24
+ * The trace origin identifying which instrumentation created the span, e.g. `auto.faas.cloudflare.durable_object`.
25
+ * Used both as the span's `sentry.origin` attribute and as the `mechanism.type` for captured exceptions.
26
+ */
27
+ origin: string;
23
28
  };
24
29
  export type UncheckedMethod = (...args: any[]) => any;
25
30
  type OriginalMethod = UncheckedMethod;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cloudflare",
3
- "version": "10.65.0",
3
+ "version": "10.67.0",
4
4
  "description": "Official Sentry SDK for Cloudflare Workers and Pages",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare",
@@ -60,12 +60,12 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@opentelemetry/api": "^1.9.1",
63
- "@sentry/core": "10.65.0",
64
- "@sentry/node": "10.65.0",
65
- "@sentry/server-utils": "10.65.0"
63
+ "@sentry/core": "10.67.0",
64
+ "@sentry/node": "10.67.0",
65
+ "@sentry/server-utils": "10.67.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@cloudflare/workers-types": "^4.x"
68
+ "@cloudflare/workers-types": "^4.x || ^5.x"
69
69
  },
70
70
  "peerDependenciesMeta": {
71
71
  "@cloudflare/workers-types": {
@@ -73,7 +73,7 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
- "@cloudflare/workers-types": "4.20250922.0",
76
+ "@cloudflare/workers-types": "5.20260710.1",
77
77
  "@types/node": "^18.19.1",
78
78
  "wrangler": "4.61.0"
79
79
  },