@adobe/helix-admin-support 5.0.0 → 5.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [5.0.1](https://github.com/adobe/helix-admin-support/compare/v5.0.0...v5.0.1) (2025-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **s3:** throw when bucket name is not mapped ([#445](https://github.com/adobe/helix-admin-support/issues/445)) ([6576357](https://github.com/adobe/helix-admin-support/commit/65763572e389aab6114763958dcf095699e4fec2))
7
+
1
8
  # [5.0.0](https://github.com/adobe/helix-admin-support/compare/v4.0.0...v5.0.0) (2025-10-13)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-admin-support",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Helix Admin Support Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/fetch-s3.js CHANGED
@@ -46,6 +46,11 @@ export async function fetchS3(context, bucketId, key, head = false) {
46
46
  HELIX_BUCKET_NAMES = null,
47
47
  } = env;
48
48
 
49
+ const bucketName = parseBucketNames(HELIX_BUCKET_NAMES)[bucketId];
50
+ if (!bucketName) {
51
+ throw new Error(`Bucket id is not mapped: ${bucketId}`);
52
+ }
53
+
49
54
  try {
50
55
  // the client initialization is a bit picky with undefined properties.
51
56
  // so we omit the credentials when we provide them via context.env
@@ -68,9 +73,8 @@ export async function fetchS3(context, bucketId, key, head = false) {
68
73
  let res;
69
74
  let buffer = '';
70
75
  try {
71
- const bucket = parseBucketNames(HELIX_BUCKET_NAMES)[bucketId];
72
76
  res = await s3.send(new Command({
73
- Bucket: bucket,
77
+ Bucket: bucketName,
74
78
  Key: key,
75
79
  }));
76
80
  if (!head) {
@@ -104,12 +108,12 @@ export async function fetchS3(context, bucketId, key, head = false) {
104
108
  } catch (e) {
105
109
  const code = e.Code ?? e.$metadata?.httpStatusCode ?? 500;
106
110
  if (code === 'AccessDenied' || code === 404 || e instanceof NoSuchKey) {
107
- log.info(`Could not find file at ${bucketId}/${key}: ${code}`);
111
+ log.info(`Could not find file at ${bucketName}/${key}: ${code}`);
108
112
  return new Response('', {
109
113
  status: 404,
110
114
  });
111
115
  } else {
112
- log.error(`Error while fetching file from ${bucketId}/${key}: ${code} (${e.message})`);
116
+ log.error(`Error while fetching file from ${bucketName}/${key}: ${code} (${e.message})`);
113
117
  return new Response('', {
114
118
  status: 502,
115
119
  headers: {