@depup/wrangler 4.112.0-depup.0 → 4.118.0-depup.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.
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/wrangler
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [wrangler](https://www.npmjs.com/package/wrangler) @ 4.112.0 |
17
- | Processed | 2026-07-21 |
16
+ | Original | [wrangler](https://www.npmjs.com/package/wrangler) @ 4.118.0 |
17
+ | Processed | 2026-08-02 |
18
18
  | Smoke test | failed |
19
19
  | Deps updated | 3 |
20
20
 
@@ -24,7 +24,7 @@ npm install @depup/wrangler
24
24
  |------------|------|-----|
25
25
  | blake3-wasm | 2.1.5 | ^3.0.0 |
26
26
  | path-to-regexp | 6.3.0 | ^8.4.2 |
27
- | workerd | 1.20260714.1 | ^1.20260721.1 |
27
+ | workerd | 1.20260730.1 | ^1.20260801.1 |
28
28
 
29
29
  ---
30
30
 
package/changes.json CHANGED
@@ -9,10 +9,10 @@
9
9
  "to": "^8.4.2"
10
10
  },
11
11
  "workerd": {
12
- "from": "1.20260714.1",
13
- "to": "^1.20260721.1"
12
+ "from": "1.20260730.1",
13
+ "to": "^1.20260801.1"
14
14
  }
15
15
  },
16
- "timestamp": "2026-07-21T16:26:30.963Z",
16
+ "timestamp": "2026-08-02T01:01:34.256Z",
17
17
  "totalUpdated": 3
18
18
  }
@@ -127,11 +127,17 @@
127
127
  "items": {
128
128
  "type": "string"
129
129
  }
130
+ },
131
+ "events": {
132
+ "type": "array",
133
+ "items": {
134
+ "$ref": "#/definitions/ArtifactsEventTrigger"
135
+ }
130
136
  }
131
137
  },
132
138
  "additionalProperties": false,
133
- "description": "\"Cron\" definitions to trigger a Worker's \"scheduled\" function.\n\nLets you call Workers periodically, much like a cron job.\n\nMore details here https://developers.cloudflare.com/workers/platform/cron-triggers\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
134
- "markdownDescription": "\"Cron\" definitions to trigger a Worker's \"scheduled\" function.\n\nLets you call Workers periodically, much like a cron job.\n\nMore details here https://developers.cloudflare.com/workers/platform/cron-triggers\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
139
+ "description": "Definitions that trigger a Worker from a schedule or a Cloudflare event.\n\nMore details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers\n\nMore details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
140
+ "markdownDescription": "Definitions that trigger a Worker from a schedule or a Cloudflare event.\n\nMore details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers\n\nMore details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
135
141
  "default": {
136
142
  "crons": []
137
143
  }
@@ -570,8 +576,7 @@
570
576
  }
571
577
  },
572
578
  "required": [
573
- "binding",
574
- "queue"
579
+ "binding"
575
580
  ],
576
581
  "additionalProperties": false
577
582
  },
@@ -679,6 +684,19 @@
679
684
  "type": "boolean",
680
685
  "description": "Whether the R2 bucket should be remote or not in local development",
681
686
  "markdownDescription": "Whether the R2 bucket should be remote or not in local development"
687
+ },
688
+ "local_dev": {
689
+ "type": "object",
690
+ "properties": {
691
+ "experimental_s3_credentials": {
692
+ "$ref": "#/definitions/LocalS3Credentials",
693
+ "description": "EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible endpoint. When set, the bucket is served at `/cdn-cgi/local/r2/s3/<bucket-name>` during local development. Ignored when the bucket runs remotely.",
694
+ "markdownDescription": "EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible\nendpoint. When set, the bucket is served at\n`/cdn-cgi/local/r2/s3/<bucket-name>` during local development.\nIgnored when the bucket runs remotely."
695
+ }
696
+ },
697
+ "additionalProperties": false,
698
+ "description": "Settings that only apply to local development",
699
+ "markdownDescription": "Settings that only apply to local development"
682
700
  }
683
701
  },
684
702
  "required": [
@@ -1305,8 +1323,7 @@
1305
1323
  }
1306
1324
  },
1307
1325
  "required": [
1308
- "binding",
1309
- "namespace"
1326
+ "binding"
1310
1327
  ],
1311
1328
  "additionalProperties": false
1312
1329
  },
@@ -1460,8 +1477,7 @@
1460
1477
  }
1461
1478
  },
1462
1479
  "required": [
1463
- "binding",
1464
- "app_id"
1480
+ "binding"
1465
1481
  ],
1466
1482
  "additionalProperties": false
1467
1483
  },
@@ -1650,6 +1666,14 @@
1650
1666
  "type": "boolean",
1651
1667
  "description": "Whether dependency instrumentation is enabled. Defaults to `true`.",
1652
1668
  "markdownDescription": "Whether dependency instrumentation is enabled. Defaults to `true`."
1669
+ },
1670
+ "exclude_packages": {
1671
+ "type": "array",
1672
+ "items": {
1673
+ "type": "string"
1674
+ },
1675
+ "description": "An optional list of package name patterns to exclude from the collected dependency metadata.\n\nEach entry can be an exact package name (e.g. `\"lodash\"`) or a glob pattern using `*` as a wildcard (e.g. `\"@internal/*\"` to exclude all packages under the `@internal` scope).",
1676
+ "markdownDescription": "An optional list of package name patterns to exclude from the\ncollected dependency metadata.\n\nEach entry can be an exact package name (e.g. `\"lodash\"`) or a glob\npattern using `*` as a wildcard (e.g. `\"@internal/*\"` to exclude all\npackages under the `@internal` scope)."
1653
1677
  }
1654
1678
  },
1655
1679
  "required": [
@@ -1864,11 +1888,17 @@
1864
1888
  "items": {
1865
1889
  "type": "string"
1866
1890
  }
1891
+ },
1892
+ "events": {
1893
+ "type": "array",
1894
+ "items": {
1895
+ "$ref": "#/definitions/ArtifactsEventTrigger"
1896
+ }
1867
1897
  }
1868
1898
  },
1869
1899
  "additionalProperties": false,
1870
- "description": "\"Cron\" definitions to trigger a Worker's \"scheduled\" function.\n\nLets you call Workers periodically, much like a cron job.\n\nMore details here https://developers.cloudflare.com/workers/platform/cron-triggers\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
1871
- "markdownDescription": "\"Cron\" definitions to trigger a Worker's \"scheduled\" function.\n\nLets you call Workers periodically, much like a cron job.\n\nMore details here https://developers.cloudflare.com/workers/platform/cron-triggers\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
1900
+ "description": "Definitions that trigger a Worker from a schedule or a Cloudflare event.\n\nMore details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers\n\nMore details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
1901
+ "markdownDescription": "Definitions that trigger a Worker from a schedule or a Cloudflare event.\n\nMore details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers\n\nMore details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
1872
1902
  "default": {
1873
1903
  "crons": []
1874
1904
  }
@@ -2307,8 +2337,7 @@
2307
2337
  }
2308
2338
  },
2309
2339
  "required": [
2310
- "binding",
2311
- "queue"
2340
+ "binding"
2312
2341
  ],
2313
2342
  "additionalProperties": false
2314
2343
  },
@@ -2416,6 +2445,19 @@
2416
2445
  "type": "boolean",
2417
2446
  "description": "Whether the R2 bucket should be remote or not in local development",
2418
2447
  "markdownDescription": "Whether the R2 bucket should be remote or not in local development"
2448
+ },
2449
+ "local_dev": {
2450
+ "type": "object",
2451
+ "properties": {
2452
+ "experimental_s3_credentials": {
2453
+ "$ref": "#/definitions/LocalS3Credentials",
2454
+ "description": "EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible endpoint. When set, the bucket is served at `/cdn-cgi/local/r2/s3/<bucket-name>` during local development. Ignored when the bucket runs remotely.",
2455
+ "markdownDescription": "EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible\nendpoint. When set, the bucket is served at\n`/cdn-cgi/local/r2/s3/<bucket-name>` during local development.\nIgnored when the bucket runs remotely."
2456
+ }
2457
+ },
2458
+ "additionalProperties": false,
2459
+ "description": "Settings that only apply to local development",
2460
+ "markdownDescription": "Settings that only apply to local development"
2419
2461
  }
2420
2462
  },
2421
2463
  "required": [
@@ -3042,8 +3084,7 @@
3042
3084
  }
3043
3085
  },
3044
3086
  "required": [
3045
- "binding",
3046
- "namespace"
3087
+ "binding"
3047
3088
  ],
3048
3089
  "additionalProperties": false
3049
3090
  },
@@ -3197,8 +3238,7 @@
3197
3238
  }
3198
3239
  },
3199
3240
  "required": [
3200
- "binding",
3201
- "app_id"
3241
+ "binding"
3202
3242
  ],
3203
3243
  "additionalProperties": false
3204
3244
  },
@@ -3681,6 +3721,65 @@
3681
3721
  ],
3682
3722
  "additionalProperties": false
3683
3723
  },
3724
+ "ArtifactsEventTrigger": {
3725
+ "type": "object",
3726
+ "properties": {
3727
+ "type": {
3728
+ "$ref": "#/definitions/ArtifactsEventType"
3729
+ },
3730
+ "filter": {
3731
+ "type": "object",
3732
+ "properties": {
3733
+ "namespace": {
3734
+ "type": "string"
3735
+ },
3736
+ "repo_name": {
3737
+ "type": "string"
3738
+ }
3739
+ },
3740
+ "additionalProperties": false
3741
+ },
3742
+ "targets": {
3743
+ "type": "array",
3744
+ "items": {
3745
+ "type": "object",
3746
+ "properties": {
3747
+ "type": {
3748
+ "type": "string",
3749
+ "const": "workflow"
3750
+ },
3751
+ "workflow_name": {
3752
+ "type": "string"
3753
+ }
3754
+ },
3755
+ "required": [
3756
+ "type",
3757
+ "workflow_name"
3758
+ ],
3759
+ "additionalProperties": false
3760
+ }
3761
+ }
3762
+ },
3763
+ "required": [
3764
+ "type",
3765
+ "targets"
3766
+ ],
3767
+ "additionalProperties": false
3768
+ },
3769
+ "ArtifactsEventType": {
3770
+ "type": "string",
3771
+ "enum": [
3772
+ "cf.artifacts.repo.created",
3773
+ "cf.artifacts.repo.deleted",
3774
+ "cf.artifacts.repo.forked",
3775
+ "cf.artifacts.repo.imported",
3776
+ "cf.artifacts.repo.pushed",
3777
+ "cf.artifacts.repo.cloned",
3778
+ "cf.artifacts.repo.fetched",
3779
+ "cf.artifacts.repo.token.created",
3780
+ "cf.artifacts.repo.token.revoked"
3781
+ ]
3782
+ },
3684
3783
  "UserLimits": {
3685
3784
  "type": "object",
3686
3785
  "properties": {
@@ -3890,16 +3989,16 @@
3890
3989
  "additionalProperties": false,
3891
3990
  "properties": {
3892
3991
  "logpush": {
3893
- "$ref": "#/definitions/interface-769040647-10589-20711-769040647-0-526752004818536"
3992
+ "$ref": "#/definitions/interface-769040647-10754-20982-769040647-0-539242004818536"
3894
3993
  },
3895
3994
  "observability": {
3896
- "$ref": "#/definitions/interface-769040647-10589-20711-769040647-0-526752004818536"
3995
+ "$ref": "#/definitions/interface-769040647-10754-20982-769040647-0-539242004818536"
3897
3996
  },
3898
3997
  "limits": {
3899
- "$ref": "#/definitions/interface-769040647-10589-20711-769040647-0-526752004818536"
3998
+ "$ref": "#/definitions/interface-769040647-10754-20982-769040647-0-539242004818536"
3900
3999
  },
3901
4000
  "cache": {
3902
- "$ref": "#/definitions/interface-769040647-10589-20711-769040647-0-526752004818536"
4001
+ "$ref": "#/definitions/interface-769040647-10754-20982-769040647-0-539242004818536"
3903
4002
  },
3904
4003
  "define": {
3905
4004
  "type": "object",
@@ -4094,8 +4193,7 @@
4094
4193
  }
4095
4194
  },
4096
4195
  "required": [
4097
- "binding",
4098
- "queue"
4196
+ "binding"
4099
4197
  ],
4100
4198
  "additionalProperties": false
4101
4199
  },
@@ -4203,6 +4301,19 @@
4203
4301
  "type": "boolean",
4204
4302
  "description": "Whether the R2 bucket should be remote or not in local development",
4205
4303
  "markdownDescription": "Whether the R2 bucket should be remote or not in local development"
4304
+ },
4305
+ "local_dev": {
4306
+ "type": "object",
4307
+ "properties": {
4308
+ "experimental_s3_credentials": {
4309
+ "$ref": "#/definitions/LocalS3Credentials",
4310
+ "description": "EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible endpoint. When set, the bucket is served at `/cdn-cgi/local/r2/s3/<bucket-name>` during local development. Ignored when the bucket runs remotely.",
4311
+ "markdownDescription": "EXPERIMENTAL: AWS SigV4 credentials for the local S3-compatible\nendpoint. When set, the bucket is served at\n`/cdn-cgi/local/r2/s3/<bucket-name>` during local development.\nIgnored when the bucket runs remotely."
4312
+ }
4313
+ },
4314
+ "additionalProperties": false,
4315
+ "description": "Settings that only apply to local development",
4316
+ "markdownDescription": "Settings that only apply to local development"
4206
4317
  }
4207
4318
  },
4208
4319
  "required": [
@@ -4829,8 +4940,7 @@
4829
4940
  }
4830
4941
  },
4831
4942
  "required": [
4832
- "binding",
4833
- "namespace"
4943
+ "binding"
4834
4944
  ],
4835
4945
  "additionalProperties": false
4836
4946
  },
@@ -4984,8 +5094,7 @@
4984
5094
  }
4985
5095
  },
4986
5096
  "required": [
4987
- "binding",
4988
- "app_id"
5097
+ "binding"
4989
5098
  ],
4990
5099
  "additionalProperties": false
4991
5100
  },
@@ -5161,7 +5270,7 @@
5161
5270
  "description": "Configuration for Worker Previews.\n\nThis defines the settings used when creating Preview deployments. Previews are branches of your Worker's main instance used to test features during feature development outside of production.\n\nThe `previews` block contains any intentionally divergent configuration intended solely for Previews, including:\n- All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)\n- Select inheritable properties: `logpush`, `observability`, `limits`, `cache`",
5162
5271
  "markdownDescription": "Configuration for Worker Previews.\n\nThis defines the settings used when creating Preview deployments.\nPreviews are branches of your Worker's main instance used to test features\nduring feature development outside of production.\n\nThe `previews` block contains any intentionally divergent configuration intended solely for Previews, including:\n- All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)\n- Select inheritable properties: `logpush`, `observability`, `limits`, `cache`"
5163
5272
  },
5164
- "interface-769040647-10589-20711-769040647-0-526752004818536": {
5273
+ "interface-769040647-10754-20982-769040647-0-539242004818536": {
5165
5274
  "type": "object",
5166
5275
  "properties": {
5167
5276
  "name": {
@@ -5273,11 +5382,17 @@
5273
5382
  "items": {
5274
5383
  "type": "string"
5275
5384
  }
5385
+ },
5386
+ "events": {
5387
+ "type": "array",
5388
+ "items": {
5389
+ "$ref": "#/definitions/ArtifactsEventTrigger"
5390
+ }
5276
5391
  }
5277
5392
  },
5278
5393
  "additionalProperties": false,
5279
- "description": "\"Cron\" definitions to trigger a Worker's \"scheduled\" function.\n\nLets you call Workers periodically, much like a cron job.\n\nMore details here https://developers.cloudflare.com/workers/platform/cron-triggers\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
5280
- "markdownDescription": "\"Cron\" definitions to trigger a Worker's \"scheduled\" function.\n\nLets you call Workers periodically, much like a cron job.\n\nMore details here https://developers.cloudflare.com/workers/platform/cron-triggers\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
5394
+ "description": "Definitions that trigger a Worker from a schedule or a Cloudflare event.\n\nMore details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers\n\nMore details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
5395
+ "markdownDescription": "Definitions that trigger a Worker from a schedule or a Cloudflare event.\n\nMore details about cron triggers: https://developers.cloudflare.com/workers/platform/cron-triggers\n\nMore details about Artifacts events: https://developers.cloudflare.com/artifacts/guides/event-subscriptions/\n\nFor reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers",
5281
5396
  "default": {
5282
5397
  "crons": []
5283
5398
  }
@@ -5933,6 +6048,24 @@
5933
6048
  "description": "Configuration for a container application",
5934
6049
  "markdownDescription": "Configuration for a container application"
5935
6050
  },
6051
+ "LocalS3Credentials": {
6052
+ "type": "object",
6053
+ "properties": {
6054
+ "accessKeyId": {
6055
+ "type": "string"
6056
+ },
6057
+ "secretAccessKey": {
6058
+ "type": "string"
6059
+ }
6060
+ },
6061
+ "required": [
6062
+ "accessKeyId",
6063
+ "secretAccessKey"
6064
+ ],
6065
+ "additionalProperties": false,
6066
+ "description": "AWS SigV4 credentials for miniflare's local S3-compatible endpoint",
6067
+ "markdownDescription": "AWS SigV4 credentials for miniflare's local S3-compatible endpoint"
6068
+ },
5936
6069
  "TailConsumer": {
5937
6070
  "type": "object",
5938
6071
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/wrangler",
3
- "version": "4.112.0-depup.0",
3
+ "version": "4.118.0-depup.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers (with updated dependencies)",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -73,16 +73,17 @@
73
73
  "esbuild": "0.28.1",
74
74
  "path-to-regexp": "^8.4.2",
75
75
  "unenv": "2.0.0-rc.24",
76
- "workerd": "^1.20260721.1",
76
+ "workerd": "^1.20260801.1",
77
+ "@cloudflare/kv-asset-handler": "0.5.0",
77
78
  "@cloudflare/unenv-preset": "2.16.1",
78
- "miniflare": "4.20260714.0",
79
- "@cloudflare/kv-asset-handler": "0.5.0"
79
+ "miniflare": "5.20260730.0-alpha"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@aws-sdk/client-s3": "^3.721.0",
83
+ "@aws-sdk/s3-request-presigner": "^3.721.0",
83
84
  "@bomb.sh/tab": "^0.0.12",
84
85
  "@cloudflare/types": "6.18.4",
85
- "@cloudflare/workers-types": "^5.20260714.1",
86
+ "@cloudflare/workers-types": "^5.20260730.1",
86
87
  "@cspotcode/source-map-support": "0.8.1",
87
88
  "@netlify/build-info": "^10.5.1",
88
89
  "@sentry/node": "^7.86.0",
@@ -162,22 +163,25 @@
162
163
  "yaml": "^2.8.1",
163
164
  "yargs": "^17.7.2",
164
165
  "zod": "4.4.3",
165
- "@cloudflare/autoconfig": "0.1.6",
166
+ "@cloudflare/build-output-utils": "0.1.0",
167
+ "@cloudflare/cli-shared-helpers": "0.1.19",
166
168
  "@cloudflare/codemod": "1.1.0",
167
- "@cloudflare/config": "0.2.1",
168
169
  "@cloudflare/containers-shared": "0.16.0",
169
- "@cloudflare/deploy-helpers": "0.5.1",
170
- "@cloudflare/cli-shared-helpers": "0.1.15",
171
- "@cloudflare/pages-shared": "^0.13.158",
172
- "@cloudflare/runtime-types": "0.0.3",
173
- "@cloudflare/workers-auth": "0.5.0",
170
+ "@cloudflare/autoconfig": "0.2.3",
171
+ "@cloudflare/deploy-helpers": "0.6.4",
172
+ "@cloudflare/config": "0.4.0",
173
+ "@cloudflare/pages-functions": "0.1.0",
174
+ "@cloudflare/remote-bindings": "0.0.6",
175
+ "@cloudflare/pages-shared": "^0.13.163",
176
+ "@cloudflare/runtime-types": "0.0.8",
174
177
  "@cloudflare/workers-shared": "0.19.9",
175
- "@cloudflare/workers-tsconfig": "0.0.0",
176
- "@cloudflare/workers-utils": "0.27.0",
177
- "@cloudflare/workflows-shared": "0.12.1"
178
+ "@cloudflare/workers-auth": "0.5.6",
179
+ "@cloudflare/workers-utils": "0.31.0",
180
+ "@cloudflare/workflows-shared": "0.12.2",
181
+ "@cloudflare/workers-tsconfig": "0.0.0"
178
182
  },
179
183
  "peerDependencies": {
180
- "@cloudflare/workers-types": "^5.20260714.1"
184
+ "@cloudflare/workers-types": "^5.20260730.1"
181
185
  },
182
186
  "peerDependenciesMeta": {
183
187
  "@cloudflare/workers-types": {
@@ -222,14 +226,14 @@
222
226
  "to": "^8.4.2"
223
227
  },
224
228
  "workerd": {
225
- "from": "1.20260714.1",
226
- "to": "^1.20260721.1"
229
+ "from": "1.20260730.1",
230
+ "to": "^1.20260801.1"
227
231
  }
228
232
  },
229
233
  "depsUpdated": 3,
230
234
  "originalPackage": "wrangler",
231
- "originalVersion": "4.112.0",
232
- "processedAt": "2026-07-21T16:26:53.061Z",
235
+ "originalVersion": "4.118.0",
236
+ "processedAt": "2026-08-02T01:02:01.336Z",
233
237
  "smokeTest": "failed"
234
238
  }
235
239
  }
@@ -22,10 +22,20 @@ const jsonError: Middleware = async (request, env, _ctx, middlewareCtx) => {
22
22
  return await middlewareCtx.next(request, env);
23
23
  } catch (e: any) {
24
24
  const error = reduceError(e);
25
- return Response.json(error, {
26
- status: 500,
27
- headers: { "MF-Experimental-Error-Stack": "true" },
28
- });
25
+ const body = JSON.stringify(error);
26
+ const headers: Record<string, string> = {
27
+ "Content-Type": "application/json",
28
+ "MF-Experimental-Error-Stack": "true",
29
+ };
30
+ // `workerd` drops response bodies for `HEAD` requests, so also carry the
31
+ // serialised error in a header. Past roughly 16KB of encoded header the
32
+ // runtime drops the whole response, so stay well under that; the body
33
+ // remains the primary channel for every method that keeps one.
34
+ const encoded = encodeURIComponent(body);
35
+ if (encoded.length <= 8192) {
36
+ headers["MF-Experimental-Error-Stack-Payload"] = encoded;
37
+ }
38
+ return new Response(body, { status: 500, headers });
29
39
  }
30
40
  };
31
41
 
@@ -2,7 +2,7 @@
2
2
  * Welcome to Cloudflare Workers! This is your first scheduled worker.
3
3
  *
4
4
  * - Run `wrangler dev` in your terminal to start a development server
5
- * - Run `curl "http://localhost:8787/cdn-cgi/handler/scheduled"` to trigger the scheduled event
5
+ * - Run `curl "http://localhost:8787/cdn-cgi/local/scheduled"` to trigger the scheduled event
6
6
  * - Go back to the console to see what your worker has logged
7
7
  * - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/configuration/cron-triggers/)
8
8
  * - Run `wrangler publish --name my-worker` to publish your worker
@@ -2,7 +2,7 @@
2
2
  * Welcome to Cloudflare Workers! This is your first scheduled worker.
3
3
  *
4
4
  * - Run `wrangler dev` in your terminal to start a development server
5
- * - Run `curl "http://localhost:8787/cdn-cgi/handler/scheduled"` to trigger the scheduled event
5
+ * - Run `curl "http://localhost:8787/cdn-cgi/local/scheduled"` to trigger the scheduled event
6
6
  * - Go back to the console to see what your worker has logged
7
7
  * - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/configuration/cron-triggers/)
8
8
  * - Run `wrangler deploy --name my-worker` to deploy your worker
@@ -1,3 +1,5 @@
1
+ // This file is a copy of packages/pages-functions/src/templates/pages-template-worker.ts.
2
+ // Changes here should be reflected there and vice-versa.
1
3
  import { match } from "path-to-regexp";
2
4
 
3
5
  //note: this explicitly does not include the * character, as pages requires this
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createDeferred,
3
- DeferredPromise,
3
+ type DeferredPromise,
4
+ isSameUserWorkerOrigin,
4
5
  rewriteUrlInHeaderValue,
5
6
  urlFromParts,
6
7
  } from "../../src/api/startDevWorker/utils";
@@ -131,6 +132,13 @@ export class ProxyWorker implements DurableObject {
131
132
  request.url
132
133
  );
133
134
 
135
+ // rewrite requests to old miniflare paths
136
+ // because wrangler cannot have a breaking change
137
+ userWorkerUrl.pathname = rewriteLegacyMiniflarePath(
138
+ userWorkerUrl.pathname
139
+ );
140
+ innerUrl.pathname = rewriteLegacyMiniflarePath(innerUrl.pathname);
141
+
134
142
  // Preserve client `Accept-Encoding`, rather than using Worker's default
135
143
  // of `Accept-Encoding: br, gzip`
136
144
  const encoding = request.cf?.clientAcceptEncoding;
@@ -182,12 +190,13 @@ export class ProxyWorker implements DurableObject {
182
190
  // we have crossed an async boundary, so proxyData may have changed
183
191
  // if proxyData.userWorkerUrl has changed, it means there is a new downstream UserWorker
184
192
  // and that this error is stale since it was for a request to the old UserWorker
185
- // so here we construct a newUserWorkerUrl so we can compare it to the (old) userWorkerUrl
186
- const newUserWorkerUrl =
187
- this.proxyData && urlFromParts(this.proxyData.userWorkerUrl);
188
-
189
- // only report errors if the downstream proxy has NOT changed
190
- if (userWorkerUrl.href === newUserWorkerUrl?.href) {
193
+ // only report the error if the request still targets the current
194
+ // UserWorker. isSameUserWorkerOrigin compares origin (not href) so a
195
+ // genuine error on a non-root path isn't misread as a reload — see
196
+ // its docs.
197
+ if (
198
+ isSameUserWorkerOrigin(userWorkerUrl, this.proxyData?.userWorkerUrl)
199
+ ) {
191
200
  void sendMessageToProxyController(this.env, {
192
201
  type: "error",
193
202
  error: {
@@ -236,6 +245,26 @@ export class ProxyWorker implements DurableObject {
236
245
  function isRequestFromProxyController(req: Request, env: Env): boolean {
237
246
  return req.headers.get("Authorization") === env.PROXY_CONTROLLER_AUTH_SECRET;
238
247
  }
248
+
249
+ // Miniflare v5 moved its internal endpoints under `/cdn-cgi/local/` (and
250
+ // `/__cf_local/` for endpoints that must remain reachable over tunnels). These
251
+ // map the pre-v5 paths onto their current equivalents.
252
+ const LEGACY_PATH_REWRITES: readonly [string, string][] = [
253
+ ["/cdn-cgi/handler", "/cdn-cgi/local"],
254
+ ["/cdn-cgi/mf/scheduled", "/cdn-cgi/local/scheduled"],
255
+ ["/cdn-cgi/mf/stream", "/__cf_local/stream"],
256
+ ["/cdn-cgi/mf/imagedelivery", "/__cf_local/imagedelivery"],
257
+ ["/cdn-cgi/explorer", "/cdn-cgi/local/explorer"],
258
+ ];
259
+
260
+ function rewriteLegacyMiniflarePath(pathname: string): string {
261
+ for (const [oldPrefix, newPrefix] of LEGACY_PATH_REWRITES) {
262
+ if (pathname === oldPrefix || pathname.startsWith(`${oldPrefix}/`)) {
263
+ return newPrefix + pathname.slice(oldPrefix.length);
264
+ }
265
+ }
266
+ return pathname;
267
+ }
239
268
  function isHtmlResponse(res: Response): boolean {
240
269
  return res.headers.get("content-type")?.startsWith("text/html") ?? false;
241
270
  }
@@ -38,6 +38,10 @@ function rewriteUrlInHeaderValue(value, from, to) {
38
38
  }
39
39
  );
40
40
  }
41
+ function isSameUserWorkerOrigin(requestUrl, parts) {
42
+ const currentUserWorkerUrl = parts && urlFromParts(parts);
43
+ return requestUrl.origin === currentUserWorkerUrl?.origin;
44
+ }
41
45
 
42
46
  // templates/startDevWorker/ProxyWorker.ts
43
47
  var LIVE_RELOAD_PROTOCOL = "WRANGLER_PROXYWORKER_LIVE_RELOAD_PROTOCOL";
@@ -118,6 +122,10 @@ var ProxyWorker = class {
118
122
  proxyData.userWorkerInnerUrlOverrides ?? {},
119
123
  request.url
120
124
  );
125
+ userWorkerUrl.pathname = rewriteLegacyMiniflarePath(
126
+ userWorkerUrl.pathname
127
+ );
128
+ innerUrl.pathname = rewriteLegacyMiniflarePath(innerUrl.pathname);
121
129
  const encoding = request.cf?.clientAcceptEncoding;
122
130
  if (encoding !== void 0) headers.set("Accept-Encoding", encoding);
123
131
  rewriteUrlRelatedHeaders(headers, outerUrl, innerUrl);
@@ -145,8 +153,7 @@ var ProxyWorker = class {
145
153
  }
146
154
  deferredResponse.resolve(res);
147
155
  }).catch((error) => {
148
- const newUserWorkerUrl = this.proxyData && urlFromParts(this.proxyData.userWorkerUrl);
149
- if (userWorkerUrl.href === newUserWorkerUrl?.href) {
156
+ if (isSameUserWorkerOrigin(userWorkerUrl, this.proxyData?.userWorkerUrl)) {
150
157
  void sendMessageToProxyController(this.env, {
151
158
  type: "error",
152
159
  error: {
@@ -177,6 +184,21 @@ var ProxyWorker = class {
177
184
  function isRequestFromProxyController(req, env) {
178
185
  return req.headers.get("Authorization") === env.PROXY_CONTROLLER_AUTH_SECRET;
179
186
  }
187
+ var LEGACY_PATH_REWRITES = [
188
+ ["/cdn-cgi/handler", "/cdn-cgi/local"],
189
+ ["/cdn-cgi/mf/scheduled", "/cdn-cgi/local/scheduled"],
190
+ ["/cdn-cgi/mf/stream", "/__cf_local/stream"],
191
+ ["/cdn-cgi/mf/imagedelivery", "/__cf_local/imagedelivery"],
192
+ ["/cdn-cgi/explorer", "/cdn-cgi/local/explorer"]
193
+ ];
194
+ function rewriteLegacyMiniflarePath(pathname) {
195
+ for (const [oldPrefix, newPrefix] of LEGACY_PATH_REWRITES) {
196
+ if (pathname === oldPrefix || pathname.startsWith(`${oldPrefix}/`)) {
197
+ return newPrefix + pathname.slice(oldPrefix.length);
198
+ }
199
+ }
200
+ return pathname;
201
+ }
180
202
  function isHtmlResponse(res) {
181
203
  return res.headers.get("content-type")?.startsWith("text/html") ?? false;
182
204
  }