wrangler 4.39.0 → 4.40.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.39.0",
3
+ "version": "4.40.1",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -54,15 +54,15 @@
54
54
  "esbuild": "0.25.4",
55
55
  "path-to-regexp": "6.3.0",
56
56
  "unenv": "2.0.0-rc.21",
57
- "workerd": "1.20250923.0",
57
+ "workerd": "1.20250924.0",
58
58
  "@cloudflare/kv-asset-handler": "0.4.0",
59
59
  "@cloudflare/unenv-preset": "2.7.4",
60
- "miniflare": "4.20250923.0"
60
+ "miniflare": "4.20250924.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
64
64
  "@cloudflare/types": "6.18.4",
65
- "@cloudflare/workers-types": "^4.20250923.0",
65
+ "@cloudflare/workers-types": "^4.20250924.0",
66
66
  "@cspotcode/source-map-support": "0.8.1",
67
67
  "@iarna/toml": "^3.0.0",
68
68
  "@sentry/node": "^7.86.0",
@@ -141,12 +141,12 @@
141
141
  "@cloudflare/cli": "1.1.2",
142
142
  "@cloudflare/containers-shared": "0.2.10",
143
143
  "@cloudflare/eslint-config-shared": "1.1.0",
144
- "@cloudflare/pages-shared": "^0.13.74",
144
+ "@cloudflare/pages-shared": "^0.13.75",
145
145
  "@cloudflare/workers-shared": "0.18.8",
146
146
  "@cloudflare/workers-tsconfig": "0.0.0"
147
147
  },
148
148
  "peerDependencies": {
149
- "@cloudflare/workers-types": "^4.20250923.0"
149
+ "@cloudflare/workers-types": "^4.20250924.0"
150
150
  },
151
151
  "peerDependenciesMeta": {
152
152
  "@cloudflare/workers-types": {
@@ -93842,7 +93842,7 @@ var name, version;
93842
93842
  var init_package = __esm({
93843
93843
  "package.json"() {
93844
93844
  name = "wrangler";
93845
- version = "4.39.0";
93845
+ version = "4.40.1";
93846
93846
  }
93847
93847
  });
93848
93848
 
@@ -102805,7 +102805,6 @@ function findWranglerConfig(referencePath = process.cwd(), { useRedirectIfAvaila
102805
102805
  };
102806
102806
  }
102807
102807
  function findRedirectedWranglerConfig(cwd2, userConfigPath) {
102808
- const PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
102809
102808
  const deployConfigPath = findUpSync(PATH_TO_DEPLOY_CONFIG, { cwd: cwd2 });
102810
102809
  if (deployConfigPath === void 0) {
102811
102810
  return userConfigPath;
@@ -102861,7 +102860,7 @@ function findRedirectedWranglerConfig(cwd2, userConfigPath) {
102861
102860
  function isRedirectedRawConfig(rawConfig, configPath, userConfigPath) {
102862
102861
  return configPath !== void 0 && configPath !== userConfigPath;
102863
102862
  }
102864
- var import_node_fs5, import_node_path7;
102863
+ var import_node_fs5, import_node_path7, PATH_TO_DEPLOY_CONFIG;
102865
102864
  var init_config_helpers = __esm({
102866
102865
  "src/config/config-helpers.ts"() {
102867
102866
  init_import_meta_url();
@@ -102872,6 +102871,7 @@ var init_config_helpers = __esm({
102872
102871
  init_errors();
102873
102872
  init_logger();
102874
102873
  init_parse();
102874
+ PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
102875
102875
  __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
102876
102876
  __name(findWranglerConfig, "findWranglerConfig");
102877
102877
  __name(findRedirectedWranglerConfig, "findRedirectedWranglerConfig");
@@ -104899,7 +104899,7 @@ Consider adding an environment configuration section to the ${configFileName(con
104899
104899
  const config = {
104900
104900
  configPath,
104901
104901
  userConfigPath,
104902
- topLevelName: rawConfig.name,
104902
+ topLevelName: isRedirectedConfig ? rawConfig.topLevelName : rawConfig.name,
104903
104903
  definedEnvironments: isRedirectedConfig ? rawConfig.definedEnvironments : definedEnvironments,
104904
104904
  targetEnvironment: isRedirectedConfig ? rawConfig.targetEnvironment : envName,
104905
104905
  pages_build_output_dir: normalizeAndValidatePagesBuildOutputDir(
@@ -132484,55 +132484,35 @@ var init_durable = __esm({
132484
132484
  function hasDefinedEnvironments(config) {
132485
132485
  return isLegacyEnv(config) && Boolean(config.definedEnvironments?.length);
132486
132486
  }
132487
- async function applyServiceAndEnvironmentTags(config, accountId, scriptName, tags) {
132488
- tags ??= [];
132487
+ function applyServiceAndEnvironmentTags(config, tags) {
132489
132488
  const env6 = config.targetEnvironment;
132490
132489
  const serviceName = config.topLevelName;
132491
- if (!serviceName) {
132490
+ const shouldApplyTags = hasDefinedEnvironments(config);
132491
+ if (shouldApplyTags && !serviceName) {
132492
132492
  logger.warn(
132493
132493
  "No top-level `name` has been defined in Wrangler configuration. Add a top-level `name` to group this Worker together with its sibling environments in the Cloudflare dashboard."
132494
132494
  );
132495
- if (tags.some((tag) => tag.startsWith(SERVICE_TAG_PREFIX))) {
132496
- try {
132497
- return await patchNonVersionedScriptSettings(
132498
- config,
132499
- accountId,
132500
- scriptName,
132501
- {
132502
- tags: tags.filter((tag) => !tag.startsWith(SERVICE_TAG_PREFIX))
132503
- }
132504
- );
132505
- } catch {
132506
- }
132507
- }
132508
- return;
132509
132495
  }
132510
- const serviceTag = `${SERVICE_TAG_PREFIX}${serviceName}`;
132511
- const environmentTag = env6 ? `${ENVIRONMENT_TAG_PREFIX}${env6}` : null;
132512
- const hasMissingServiceTag = !tags.includes(serviceTag);
132513
- const hasMissingOrStaleEnvironmentTag = environmentTag ? !tags.includes(environmentTag) : tags.some((tag) => tag.startsWith(ENVIRONMENT_TAG_PREFIX));
132514
- if (hasMissingServiceTag || hasMissingOrStaleEnvironmentTag) {
132515
- const nextTags = tags.filter(
132516
- (tag) => !tag.startsWith(SERVICE_TAG_PREFIX) && !tag.startsWith(ENVIRONMENT_TAG_PREFIX)
132517
- ).concat([serviceTag]);
132518
- if (environmentTag) {
132519
- nextTags.push(environmentTag);
132520
- }
132521
- try {
132522
- return await patchNonVersionedScriptSettings(
132523
- config,
132524
- accountId,
132525
- scriptName,
132526
- {
132527
- tags: nextTags
132528
- }
132529
- );
132530
- } catch {
132531
- logger.warn(
132532
- "Could not apply service and environment tags. This Worker will not appear grouped together with its sibling environments in the Cloudflare dashboard."
132533
- );
132534
- }
132496
+ const serviceTag = shouldApplyTags && serviceName ? `${SERVICE_TAG_PREFIX}${serviceName}` : null;
132497
+ const environmentTag = serviceTag && env6 ? `${ENVIRONMENT_TAG_PREFIX}${env6}` : null;
132498
+ tags = tags.filter(
132499
+ (tag) => !tag.startsWith(SERVICE_TAG_PREFIX) && !tag.startsWith(ENVIRONMENT_TAG_PREFIX)
132500
+ );
132501
+ if (serviceTag) {
132502
+ tags.push(serviceTag);
132503
+ }
132504
+ if (environmentTag) {
132505
+ tags.push(environmentTag);
132535
132506
  }
132507
+ return tags;
132508
+ }
132509
+ function warnOnErrorUpdatingServiceAndEnvironmentTags() {
132510
+ logger.warn(
132511
+ "Could not apply service and environment tags. This Worker will not appear grouped together with its sibling environments in the Cloudflare dashboard."
132512
+ );
132513
+ }
132514
+ function tagsAreEqual(a6, b7) {
132515
+ return a6.length === b7.length && a6.every((el, i6) => b7[i6] === el);
132536
132516
  }
132537
132517
  var SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX;
132538
132518
  var init_environments = __esm({
@@ -132540,11 +132520,12 @@ var init_environments = __esm({
132540
132520
  init_import_meta_url();
132541
132521
  init_logger();
132542
132522
  init_isLegacyEnv();
132543
- init_api();
132544
132523
  SERVICE_TAG_PREFIX = "cf:service=";
132545
132524
  ENVIRONMENT_TAG_PREFIX = "cf:environment=";
132546
132525
  __name(hasDefinedEnvironments, "hasDefinedEnvironments");
132547
132526
  __name(applyServiceAndEnvironmentTags, "applyServiceAndEnvironmentTags");
132527
+ __name(warnOnErrorUpdatingServiceAndEnvironmentTags, "warnOnErrorUpdatingServiceAndEnvironmentTags");
132528
+ __name(tagsAreEqual, "tagsAreEqual");
132548
132529
  }
132549
132530
  });
132550
132531
 
@@ -144970,15 +144951,8 @@ function createHandler(def, commandName) {
144970
144951
  useRedirectIfAvailable: def.behaviour?.useConfigRedirectIfAvailable
144971
144952
  }) : defaultWranglerConfig;
144972
144953
  if (def.behaviour?.warnIfMultipleEnvsConfiguredButNoneSpecified) {
144973
- if (!("env" in args) && config.configPath) {
144974
- const { rawConfig } = experimental_readRawConfig(
144975
- {
144976
- config: config.configPath
144977
- },
144978
- { hideWarnings: true }
144979
- );
144980
- const availableEnvs = Object.keys(rawConfig.env ?? {});
144981
- if (availableEnvs.length > 0) {
144954
+ if (!("env" in args)) {
144955
+ if (hasDefinedEnvironments(config)) {
144982
144956
  logger.warn(
144983
144957
  dedent2`
144984
144958
  Multiple environments are defined in the Wrangler configuration file, but no target environment was specified for the ${commandName.replace(/^wrangler\s+/, "")} command.
@@ -145010,6 +144984,7 @@ var init_register_yargs_command = __esm({
145010
144984
  init_internal();
145011
144985
  init_config5();
145012
144986
  init_config4();
144987
+ init_environments();
145013
144988
  init_errors();
145014
144989
  init_experimental_flags();
145015
144990
  init_logger();
@@ -158482,7 +158457,14 @@ var init_secret = __esm({
158482
158457
  `\u{1F300} Deleting the secret ${args.key} on the Worker ${scriptName}${args.env && !isLegacyEnv(config) ? ` (${args.env})` : ""}`
158483
158458
  );
158484
158459
  const url4 = !args.env || isLegacyEnv(config) ? `/accounts/${accountId}/workers/scripts/${scriptName}/secrets` : `/accounts/${accountId}/workers/services/${scriptName}/environments/${args.env}/secrets`;
158485
- await fetchResult(config, `${url4}/${args.key}`, { method: "DELETE" });
158460
+ await fetchResult(
158461
+ config,
158462
+ `${url4}/${encodeURIComponent(args.key)}`,
158463
+ { method: "DELETE" },
158464
+ new URLSearchParams({
158465
+ url_encoded: "true"
158466
+ })
158467
+ );
158486
158468
  sendMetricsEvent("delete encrypted variable", {
158487
158469
  sendMetrics: config.send_metrics
158488
158470
  });
@@ -192164,8 +192146,8 @@ function generateSampleValue(field) {
192164
192146
  case "int64":
192165
192147
  return "9223372036854775807";
192166
192148
  // Large numbers as strings to avoid JS precision issues
192167
- case "f32":
192168
- case "f64":
192149
+ case "float32":
192150
+ case "float64":
192169
192151
  return 3.14;
192170
192152
  case "json":
192171
192153
  return { example: "json_value" };
@@ -193040,6 +193022,72 @@ var init_list5 = __esm({
193040
193022
  }
193041
193023
  });
193042
193024
 
193025
+ // src/pipelines/defaults.ts
193026
+ function applyDefaultsToSink(sink) {
193027
+ const withDefaults = {
193028
+ ...sink,
193029
+ format: { ...sink.format },
193030
+ config: { ...sink.config }
193031
+ };
193032
+ if (withDefaults.format.type === "parquet") {
193033
+ if (!withDefaults.format.compression) {
193034
+ withDefaults.format.compression = SINK_DEFAULTS.format.compression;
193035
+ }
193036
+ if (!withDefaults.format.row_group_bytes) {
193037
+ withDefaults.format.row_group_bytes = SINK_DEFAULTS.format.row_group_bytes;
193038
+ }
193039
+ }
193040
+ if (!withDefaults.config.rolling_policy) {
193041
+ withDefaults.config.rolling_policy = {
193042
+ interval_seconds: SINK_DEFAULTS.rolling_policy.interval_seconds
193043
+ };
193044
+ if (SINK_DEFAULTS.rolling_policy.file_size_bytes !== void 0) {
193045
+ withDefaults.config.rolling_policy.file_size_bytes = SINK_DEFAULTS.rolling_policy.file_size_bytes;
193046
+ }
193047
+ } else {
193048
+ if (!withDefaults.config.rolling_policy.file_size_bytes && SINK_DEFAULTS.rolling_policy.file_size_bytes !== void 0) {
193049
+ withDefaults.config.rolling_policy.file_size_bytes = SINK_DEFAULTS.rolling_policy.file_size_bytes;
193050
+ }
193051
+ if (!withDefaults.config.rolling_policy.interval_seconds) {
193052
+ withDefaults.config.rolling_policy.interval_seconds = SINK_DEFAULTS.rolling_policy.interval_seconds;
193053
+ }
193054
+ }
193055
+ if (withDefaults.type === "r2") {
193056
+ if (!withDefaults.config.path) {
193057
+ withDefaults.config.path = SINK_DEFAULTS.r2.path;
193058
+ }
193059
+ if (!withDefaults.config.partitioning) {
193060
+ withDefaults.config.partitioning = SINK_DEFAULTS.r2.partitioning;
193061
+ }
193062
+ }
193063
+ return withDefaults;
193064
+ }
193065
+ var SINK_DEFAULTS;
193066
+ var init_defaults = __esm({
193067
+ "src/pipelines/defaults.ts"() {
193068
+ init_import_meta_url();
193069
+ SINK_DEFAULTS = {
193070
+ format: {
193071
+ type: "parquet",
193072
+ compression: "zstd",
193073
+ row_group_bytes: 1024 * 1024 * 1024
193074
+ },
193075
+ rolling_policy: {
193076
+ file_size_bytes: void 0,
193077
+ interval_seconds: 300
193078
+ },
193079
+ r2: {
193080
+ path: "",
193081
+ partitioning: {
193082
+ time_pattern: "year=%Y/month=%m/day=%d"
193083
+ }
193084
+ },
193085
+ r2_data_catalog: {}
193086
+ };
193087
+ __name(applyDefaultsToSink, "applyDefaultsToSink");
193088
+ }
193089
+ });
193090
+
193043
193091
  // src/pipelines/cli/setup.ts
193044
193092
  async function setupPipelineNaming(providedName) {
193045
193093
  const pipelineName = providedName || await prompt("What would you like to name your pipeline?");
@@ -193160,10 +193208,8 @@ async function buildField(fieldNumber, depth = 0) {
193160
193208
  { title: "string", value: "string" },
193161
193209
  { title: "int32", value: "int32" },
193162
193210
  { title: "int64", value: "int64" },
193163
- { title: "u_int32", value: "u_int32" },
193164
- { title: "u_int64", value: "u_int64" },
193165
- { title: "f32", value: "f32" },
193166
- { title: "f64", value: "f64" },
193211
+ { title: "float32", value: "float32" },
193212
+ { title: "float64", value: "float64" },
193167
193213
  { title: "bool", value: "bool" },
193168
193214
  { title: "timestamp", value: "timestamp" },
193169
193215
  { title: "json", value: "json" },
@@ -193311,13 +193357,16 @@ async function setupR2Sink(config, accountId, setupConfig) {
193311
193357
  fallbackOption: 3
193312
193358
  });
193313
193359
  }
193314
- const fileSizeMB = await prompt("Roll file when size reaches (MB):", {
193315
- defaultValue: "100"
193316
- });
193360
+ const fileSizeMB = await prompt(
193361
+ "Roll file when size reaches (MB, minimum 5):",
193362
+ {
193363
+ defaultValue: "100"
193364
+ }
193365
+ );
193317
193366
  const intervalSeconds = await prompt(
193318
- "Roll file when time reaches (seconds):",
193367
+ "Roll file when time reaches (seconds, minimum 10):",
193319
193368
  {
193320
- defaultValue: "300"
193369
+ defaultValue: String(SINK_DEFAULTS.rolling_policy.interval_seconds)
193321
193370
  }
193322
193371
  );
193323
193372
  const useOAuth = await confirm(
@@ -193396,16 +193445,19 @@ async function setupDataCatalogSink(setupConfig) {
193396
193445
  { title: "zstd", value: "zstd" },
193397
193446
  { title: "lz4", value: "lz4" }
193398
193447
  ],
193399
- defaultOption: 0,
193400
- fallbackOption: 0
193401
- });
193402
- const fileSizeMB = await prompt("Roll file when size reaches (MB):", {
193403
- defaultValue: "100"
193448
+ defaultOption: 3,
193449
+ fallbackOption: 3
193404
193450
  });
193451
+ const fileSizeMB = await prompt(
193452
+ "Roll file when size reaches (MB, minimum 5):",
193453
+ {
193454
+ defaultValue: "100"
193455
+ }
193456
+ );
193405
193457
  const intervalSeconds = await prompt(
193406
- "Roll file when time reaches (seconds):",
193458
+ "Roll file when time reaches (seconds, minimum 10):",
193407
193459
  {
193408
- defaultValue: "300"
193460
+ defaultValue: String(SINK_DEFAULTS.rolling_policy.interval_seconds)
193409
193461
  }
193410
193462
  );
193411
193463
  setupConfig.sinkConfig = {
@@ -193644,6 +193696,7 @@ var init_setup = __esm({
193644
193696
  init_helpers();
193645
193697
  init_user3();
193646
193698
  init_client7();
193699
+ init_defaults();
193647
193700
  init_pipelines2();
193648
193701
  init_utils12();
193649
193702
  pipelinesSetupCommand = createCommand({
@@ -193713,70 +193766,6 @@ var init_sinks = __esm({
193713
193766
  }
193714
193767
  });
193715
193768
 
193716
- // src/pipelines/defaults.ts
193717
- function applyDefaultsToSink(sink) {
193718
- const withDefaults = {
193719
- ...sink,
193720
- format: { ...sink.format },
193721
- config: { ...sink.config }
193722
- };
193723
- if (withDefaults.format.type === "parquet") {
193724
- if (!withDefaults.format.compression) {
193725
- withDefaults.format.compression = SINK_DEFAULTS.format.compression;
193726
- }
193727
- if (!withDefaults.format.row_group_bytes) {
193728
- withDefaults.format.row_group_bytes = SINK_DEFAULTS.format.row_group_bytes;
193729
- }
193730
- }
193731
- if (!withDefaults.config.rolling_policy) {
193732
- withDefaults.config.rolling_policy = {
193733
- file_size_bytes: SINK_DEFAULTS.rolling_policy.file_size_bytes,
193734
- interval_seconds: SINK_DEFAULTS.rolling_policy.interval_seconds
193735
- };
193736
- } else {
193737
- if (!withDefaults.config.rolling_policy.file_size_bytes) {
193738
- withDefaults.config.rolling_policy.file_size_bytes = SINK_DEFAULTS.rolling_policy.file_size_bytes;
193739
- }
193740
- if (!withDefaults.config.rolling_policy.interval_seconds) {
193741
- withDefaults.config.rolling_policy.interval_seconds = SINK_DEFAULTS.rolling_policy.interval_seconds;
193742
- }
193743
- }
193744
- if (withDefaults.type === "r2") {
193745
- if (!withDefaults.config.path) {
193746
- withDefaults.config.path = SINK_DEFAULTS.r2.path;
193747
- }
193748
- if (!withDefaults.config.partitioning) {
193749
- withDefaults.config.partitioning = SINK_DEFAULTS.r2.partitioning;
193750
- }
193751
- }
193752
- return withDefaults;
193753
- }
193754
- var SINK_DEFAULTS;
193755
- var init_defaults = __esm({
193756
- "src/pipelines/defaults.ts"() {
193757
- init_import_meta_url();
193758
- SINK_DEFAULTS = {
193759
- format: {
193760
- type: "parquet",
193761
- compression: "zstd",
193762
- row_group_bytes: 1024 * 1024 * 1024
193763
- },
193764
- rolling_policy: {
193765
- file_size_bytes: 0,
193766
- interval_seconds: 30
193767
- },
193768
- r2: {
193769
- path: "",
193770
- partitioning: {
193771
- time_pattern: "year=%Y/month=%m/day=%d"
193772
- }
193773
- },
193774
- r2_data_catalog: {}
193775
- };
193776
- __name(applyDefaultsToSink, "applyDefaultsToSink");
193777
- }
193778
- });
193779
-
193780
193769
  // src/pipelines/cli/sinks/utils.ts
193781
193770
  function displaySinkConfiguration(sink, title = "Configuration", options = {}) {
193782
193771
  const { includeTimestamps = true } = options;
@@ -193808,7 +193797,7 @@ ${title}:`);
193808
193797
  const fileSizeBytes = sink.config.rolling_policy?.file_size_bytes ?? SINK_DEFAULTS.rolling_policy.file_size_bytes;
193809
193798
  const intervalSeconds = sink.config.rolling_policy?.interval_seconds ?? SINK_DEFAULTS.rolling_policy.interval_seconds;
193810
193799
  const batching = {
193811
- "File Size": fileSizeBytes === 0 ? "none" : `${Math.round(fileSizeBytes / (1024 * 1024))}MB`,
193800
+ "File Size": fileSizeBytes === void 0 || fileSizeBytes === 0 ? "none" : `${Math.round(fileSizeBytes / (1024 * 1024))}MB`,
193812
193801
  "Time Interval": `${intervalSeconds}s`
193813
193802
  };
193814
193803
  const format9 = {
@@ -193926,8 +193915,7 @@ var init_create6 = __esm({
193926
193915
  },
193927
193916
  "roll-size": {
193928
193917
  describe: "Roll file size in MB",
193929
- type: "number",
193930
- default: SINK_DEFAULTS.rolling_policy.file_size_bytes / (1024 * 1024)
193918
+ type: "number"
193931
193919
  },
193932
193920
  "roll-interval": {
193933
193921
  describe: "Roll file interval in seconds",
@@ -194033,7 +194021,7 @@ var init_create6 = __esm({
194033
194021
  interval_seconds = args.rollInterval;
194034
194022
  }
194035
194023
  sinkConfig.config.rolling_policy = {
194036
- file_size_bytes,
194024
+ ...file_size_bytes !== void 0 && { file_size_bytes },
194037
194025
  interval_seconds
194038
194026
  };
194039
194027
  }
@@ -197050,8 +197038,8 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
197050
197038
  type: "string",
197051
197039
  demandOption: true
197052
197040
  },
197053
- targetSizeMb: {
197054
- describe: "The target size for compacted files (allowed values: 64, 128, 256, 512)",
197041
+ "target-size": {
197042
+ describe: "The target size for compacted files in MB (allowed values: 64, 128, 256, 512)",
197055
197043
  type: "number",
197056
197044
  demandOption: false,
197057
197045
  default: 128
@@ -197074,7 +197062,7 @@ For more details, refer to: https://developers.cloudflare.com/r2/api/s3/tokens/`
197074
197062
  config,
197075
197063
  accountId,
197076
197064
  args.bucket,
197077
- args.targetSizeMb
197065
+ args.targetSize
197078
197066
  );
197079
197067
  logger.log(
197080
197068
  `\u2728 Successfully enabled file compaction for the data catalog for bucket '${args.bucket}'.`
@@ -215440,7 +215428,7 @@ async function versionsUpload(props) {
215440
215428
  const { config, accountId, name: name2 } = props;
215441
215429
  let versionId = null;
215442
215430
  let workerTag = null;
215443
- let tags = null;
215431
+ let tags = [];
215444
215432
  if (accountId && name2) {
215445
215433
  try {
215446
215434
  const {
@@ -215451,7 +215439,7 @@ async function versionsUpload(props) {
215451
215439
  // TODO(consider): should this be a /versions endpoint?
215452
215440
  );
215453
215441
  workerTag = script.tag;
215454
- tags = script.tags;
215442
+ tags = script.tags ?? tags;
215455
215443
  if (script.last_deployed_from === "dash") {
215456
215444
  logger.warn(
215457
215445
  `You are about to upload a Worker Version that was last published via the Cloudflare Dashboard.
@@ -215757,13 +215745,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
215757
215745
  }
215758
215746
  throw err;
215759
215747
  }
215760
- if (hasDefinedEnvironments(config)) {
215761
- await applyServiceAndEnvironmentTags(
215762
- config,
215763
- accountId,
215764
- scriptName,
215765
- tags
215766
- );
215748
+ const nextTags = applyServiceAndEnvironmentTags(config, tags);
215749
+ if (!tagsAreEqual(tags, nextTags)) {
215750
+ try {
215751
+ await patchNonVersionedScriptSettings(config, accountId, scriptName, {
215752
+ tags: nextTags
215753
+ });
215754
+ } catch {
215755
+ warnOnErrorUpdatingServiceAndEnvironmentTags();
215756
+ }
215767
215757
  }
215768
215758
  }
215769
215759
  if (props.outFile) {
@@ -215923,6 +215913,7 @@ var init_upload5 = __esm({
215923
215913
  init_isLegacyEnv();
215924
215914
  init_print_bindings();
215925
215915
  init_retry();
215916
+ init_api();
215926
215917
  versionsUploadCommand = createCommand({
215927
215918
  metadata: {
215928
215919
  description: "Uploads your Worker code and config as a new Version",
@@ -222702,7 +222693,7 @@ async function deploy(props) {
222702
222693
  const { config, accountId, name: name2, entry } = props;
222703
222694
  let workerTag = null;
222704
222695
  let versionId = null;
222705
- let tags = null;
222696
+ let tags = [];
222706
222697
  let workerExists = true;
222707
222698
  const domainRoutes = (props.domains || []).map((domain2) => ({
222708
222699
  pattern: domain2,
@@ -222717,7 +222708,7 @@ async function deploy(props) {
222717
222708
  default_environment: { script }
222718
222709
  } = serviceMetaData;
222719
222710
  workerTag = script.tag;
222720
- tags = script.tags;
222711
+ tags = script.tags ?? tags;
222721
222712
  if (script.last_deployed_from === "dash") {
222722
222713
  let configDiff;
222723
222714
  if (getFlag("DEPLOY_REMOTE_DIFF_CHECK")) {
@@ -223111,19 +223102,25 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
223111
223102
  versionMap,
223112
223103
  void 0
223113
223104
  );
223114
- await patchNonVersionedScriptSettings(
223115
- props.config,
223116
- accountId,
223117
- scriptName,
223118
- {
223119
- tail_consumers: worker.tail_consumers,
223120
- logpush: worker.logpush,
223121
- // If the user hasn't specified observability assume that they want it disabled if they have it on.
223122
- // This is a no-op in the event that they don't have observability enabled, but will remove observability
223123
- // if it has been removed from their Wrangler configuration file
223124
- observability: worker.observability ?? { enabled: false }
223125
- }
223126
- );
223105
+ const nextTags = applyServiceAndEnvironmentTags(config, tags);
223106
+ try {
223107
+ await patchNonVersionedScriptSettings(
223108
+ props.config,
223109
+ accountId,
223110
+ scriptName,
223111
+ {
223112
+ tail_consumers: worker.tail_consumers,
223113
+ logpush: worker.logpush,
223114
+ // If the user hasn't specified observability assume that they want it disabled if they have it on.
223115
+ // This is a no-op in the event that they don't have observability enabled, but will remove observability
223116
+ // if it has been removed from their Wrangler configuration file
223117
+ observability: worker.observability ?? { enabled: false },
223118
+ tags: nextTags
223119
+ }
223120
+ );
223121
+ } catch {
223122
+ warnOnErrorUpdatingServiceAndEnvironmentTags();
223123
+ }
223127
223124
  result = {
223128
223125
  id: null,
223129
223126
  // fpw - ignore
@@ -223153,14 +223150,21 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
223153
223150
  })
223154
223151
  )
223155
223152
  );
223156
- }
223157
- if (hasDefinedEnvironments(config)) {
223158
- await applyServiceAndEnvironmentTags(
223159
- config,
223160
- accountId,
223161
- scriptName,
223162
- tags
223163
- );
223153
+ const nextTags = applyServiceAndEnvironmentTags(config, tags);
223154
+ if (!tagsAreEqual(tags, nextTags)) {
223155
+ try {
223156
+ await patchNonVersionedScriptSettings(
223157
+ props.config,
223158
+ accountId,
223159
+ scriptName,
223160
+ {
223161
+ tags: nextTags
223162
+ }
223163
+ );
223164
+ } catch {
223165
+ warnOnErrorUpdatingServiceAndEnvironmentTags();
223166
+ }
223167
+ }
223164
223168
  }
223165
223169
  if (result.startup_time_ms) {
223166
223170
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
@@ -224993,9 +224997,36 @@ var init_BundlerController = __esm({
224993
224997
  data: void 0
224994
224998
  });
224995
224999
  }
224996
- void this.#startCustomBuild(event.config);
224997
- void this.#startBundle(event.config);
224998
- void this.#ensureWatchingAssets(event.config);
225000
+ void this.#startCustomBuild(event.config).catch((err) => {
225001
+ logger.error("Failed to run custom build:", err);
225002
+ this.emitErrorEvent({
225003
+ type: "error",
225004
+ reason: "Failed to run custom build",
225005
+ cause: castErrorCause(err),
225006
+ source: "BundlerController",
225007
+ data: { config: event.config }
225008
+ });
225009
+ });
225010
+ void this.#startBundle(event.config).catch((err) => {
225011
+ logger.error("Failed to start bundler:", err);
225012
+ this.emitErrorEvent({
225013
+ type: "error",
225014
+ reason: "Failed to start bundler",
225015
+ cause: castErrorCause(err),
225016
+ source: "BundlerController",
225017
+ data: { config: event.config }
225018
+ });
225019
+ });
225020
+ void this.#ensureWatchingAssets(event.config).catch((err) => {
225021
+ logger.error("Failed to watch assets:", err);
225022
+ this.emitErrorEvent({
225023
+ type: "error",
225024
+ reason: "Failed to watch assets",
225025
+ cause: castErrorCause(err),
225026
+ source: "BundlerController",
225027
+ data: { config: event.config }
225028
+ });
225029
+ });
224999
225030
  }
225000
225031
  async teardown() {
225001
225032
  logger.debug("BundlerController teardown beginning...");
@@ -225394,7 +225425,7 @@ If you are trying to develop Pages and Workers together, please use \`wrangler p
225394
225425
  script: input.entrypoint,
225395
225426
  moduleRoot: input.build?.moduleRoot,
225396
225427
  // getEntry only needs to know if assets was specified.
225397
- // The actualy value is not relevant here, which is why not passing
225428
+ // The actual value is not relevant here, which is why not passing
225398
225429
  // the entire Assets object is fine.
225399
225430
  assets: input?.assets
225400
225431
  },