Skip to content

Commit b9c2525

Browse files
committed
fix: gracefully skip PutPublicAccessBlock for S3-compatible backends that don't support it
1 parent 1a55e6a commit b9c2525

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

packages/bucket-provisioner/src/provisioner.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ export class BucketProvisioner {
239239

240240
/**
241241
* Configure S3 Block Public Access settings.
242+
*
243+
* Gracefully skips if the S3-compatible backend (e.g. MinIO) does not
244+
* support PutPublicAccessBlock — the operation is best-effort since
245+
* not all providers implement this AWS-specific API.
242246
*/
243247
async setPublicAccessBlock(
244248
bucketName: string,
@@ -252,6 +256,20 @@ export class BucketProvisioner {
252256
}),
253257
);
254258
} catch (err: any) {
259+
// Some S3-compatible backends (e.g. older MinIO) don't support
260+
// PutPublicAccessBlock. Treat XML parse errors or "not implemented"
261+
// responses as non-fatal — the bucket is still usable.
262+
if (
263+
err.Code === 'XmlParseException' ||
264+
err.name === 'XmlParseException' ||
265+
err.Code === 'NotImplemented' ||
266+
err.name === 'NotImplemented' ||
267+
err.message?.includes('not well-formed') ||
268+
err.message?.includes('not implemented') ||
269+
err.message?.includes('PublicAccessBlockConfiguration')
270+
) {
271+
return;
272+
}
255273
throw new ProvisionerError(
256274
'POLICY_FAILED',
257275
`Failed to set public access block on '${bucketName}': ${err.message}`,

0 commit comments

Comments
 (0)