@adobe/helix-config 5.6.7 → 5.6.8
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 +7 -0
- package/package.json +1 -1
- package/src/config-view.js +18 -1
- package/src/status-code-error.js +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [5.6.8](https://github.com/adobe/helix-config/compare/v5.6.7...v5.6.8) (2025-10-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* return 502 for potential storage errors ([#321](https://github.com/adobe/helix-config/issues/321)) ([45c4b5b](https://github.com/adobe/helix-config/commit/45c4b5bbd6dc3c66a63667aed08370e5778927b3))
|
|
7
|
+
|
|
1
8
|
## [5.6.7](https://github.com/adobe/helix-config/compare/v5.6.6...v5.6.7) (2025-09-29)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/config-view.js
CHANGED
|
@@ -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
|
-
|
|
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
|
+
}
|