@adobe/helix-config 5.6.7 → 5.6.9

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.6.9](https://github.com/adobe/helix-config/compare/v5.6.8...v5.6.9) (2025-10-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * return 404 if legacy config has no contentBusId ([#328](https://github.com/adobe/helix-config/issues/328)) ([a532acd](https://github.com/adobe/helix-config/commit/a532acd172af2755e20aca25058aaa9097041360))
7
+
8
+ ## [5.6.8](https://github.com/adobe/helix-config/compare/v5.6.7...v5.6.8) (2025-10-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * return 502 for potential storage errors ([#321](https://github.com/adobe/helix-config/issues/321)) ([45c4b5b](https://github.com/adobe/helix-config/commit/45c4b5bbd6dc3c66a63667aed08370e5778927b3))
14
+
1
15
  ## [5.6.7](https://github.com/adobe/helix-config/compare/v5.6.6...v5.6.7) (2025-09-29)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "5.6.7",
3
+ "version": "5.6.9",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "https://github.com/adobe/helix-config"
20
+ "url": "https://github.com/adobe/helix-config.git"
21
21
  },
22
22
  "author": "",
23
23
  "license": "Apache-2.0",
@@ -35,20 +35,20 @@
35
35
  "reporter-options": "configFile=.mocha-multi.json"
36
36
  },
37
37
  "devDependencies": {
38
- "@adobe/eslint-config-helix": "3.0.10",
39
- "@eslint/config-helpers": "0.3.1",
38
+ "@adobe/eslint-config-helix": "3.0.12",
39
+ "@eslint/config-helpers": "0.4.0",
40
40
  "@semantic-release/changelog": "6.0.3",
41
41
  "@semantic-release/git": "10.0.1",
42
- "@semantic-release/npm": "12.0.2",
42
+ "@semantic-release/npm": "13.0.0",
43
43
  "c8": "10.1.3",
44
44
  "eslint": "9.4.0",
45
45
  "husky": "9.1.7",
46
46
  "junit-report-builder": "5.1.1",
47
- "lint-staged": "16.1.6",
48
- "mocha": "11.7.2",
47
+ "lint-staged": "16.2.3",
48
+ "mocha": "11.7.4",
49
49
  "mocha-multi-reporters": "1.5.1",
50
50
  "mocha-suppress-logs": "0.6.0",
51
- "semantic-release": "24.2.8"
51
+ "semantic-release": "25.0.0"
52
52
  },
53
53
  "lint-staged": {
54
54
  "*.js": "eslint",
@@ -114,6 +114,9 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
114
114
  }
115
115
  const helixConfig = cfg.data;
116
116
  const { contentBusId } = helixConfig.content.data['/'];
117
+ if (!contentBusId) {
118
+ return null;
119
+ }
117
120
  const fstab = helixConfig.fstab?.data || helixConfig.fstab;
118
121
  if (!fstab) {
119
122
  return null;
@@ -22,6 +22,7 @@ import { resolveLegacyConfig, fetchRobotsTxt, toArray } from './config-legacy.js
22
22
  import { deepGetOrCreate, prune } from './utils.js';
23
23
  import { ConfigObject } from './config-object.js';
24
24
  import { ModifiersConfig } from './ModifiersConfig.js';
25
+ import { StatusCodeError } from './status-code-error.js';
25
26
 
26
27
  /**
27
28
  * @typedef Config
@@ -288,6 +289,10 @@ async function resolveConfig(ctx, rso, scope) {
288
289
  ctx.timer?.update('load-config');
289
290
  const res = await ctx.loader.getObject(HELIX_CONFIG_BUS, key);
290
291
  if (!res.body) {
292
+ if (res.status !== 404) {
293
+ ctx.log.error('error loading config %s: %d', key, res.status);
294
+ throw new StatusCodeError('error loading config', res.status);
295
+ }
291
296
  const config = await resolveLegacyConfig(ctx, rso, scope);
292
297
  if (config) {
293
298
  ctx.timer?.update('profile');
@@ -523,7 +528,19 @@ export async function getConfigResponse(ctx, opts) {
523
528
  }
524
529
 
525
530
  const rso = { ref, site, org };
526
- const siteConfig = await resolveConfig(ctx, rso, scope);
531
+ let siteConfig;
532
+ try {
533
+ siteConfig = await resolveConfig(ctx, rso, scope);
534
+ } catch (e) {
535
+ return new PipelineResponse('', {
536
+ status: 502,
537
+ headers: {
538
+ 'x-surrogate-key': await getSurrogateKey(opts, null),
539
+ /* c8 ignore next */
540
+ 'x-error': `${e.message} (${e.statusCode || 500})`,
541
+ },
542
+ });
543
+ }
527
544
  const headers = {
528
545
  'x-surrogate-key': await getSurrogateKey(opts, siteConfig?.data),
529
546
  };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ export class StatusCodeError extends Error {
13
+ /**
14
+ * Constructs a StatusCodeError.
15
+ * @constructor
16
+ * @param {string} msg Error message
17
+ * @param {number} statusCode Status code of the error response
18
+ */
19
+ constructor(msg, statusCode) {
20
+ super(msg?.value ?? msg);
21
+ this.statusCode = statusCode;
22
+ }
23
+ }
package/src/utils.js CHANGED
@@ -50,7 +50,7 @@ export function prune(obj, path = '') {
50
50
  // eslint-disable-next-line no-param-reassign
51
51
  delete obj[key];
52
52
  }
53
- } else if (typeof prop === 'object') {
53
+ } else if (prop && typeof prop === 'object') {
54
54
  prune(prop, itemPath);
55
55
  if (Object.keys(prop).length === 0) {
56
56
  // eslint-disable-next-line no-param-reassign