@@ -29,8 +29,22 @@ export function getBucketProvisionerConnection(): StorageConnectionConfig {
2929
3030 const { cdn } = getEnvOptions ( ) ;
3131
32- // cdn is guaranteed populated — pgpmDefaults provides all CDN fields
33- const { provider, awsRegion, awsAccessKey, awsSecretKey, endpoint } = cdn ! ;
32+ if ( ! cdn ) {
33+ throw new Error (
34+ '[bucket-provisioner-resolver] CDN config not found. ' +
35+ 'Ensure CDN environment variables (AWS_ACCESS_KEY, AWS_SECRET_KEY, etc.) ' +
36+ 'are set or that pgpmDefaults provides CDN fields.' ,
37+ ) ;
38+ }
39+
40+ const { provider, awsRegion, awsAccessKey, awsSecretKey, endpoint } = cdn ;
41+
42+ if ( ! awsAccessKey || ! awsSecretKey ) {
43+ throw new Error (
44+ '[bucket-provisioner-resolver] Missing S3 credentials. ' +
45+ 'Set AWS_ACCESS_KEY and AWS_SECRET_KEY environment variables.' ,
46+ ) ;
47+ }
3448
3549 log . info (
3650 `[bucket-provisioner-resolver] Initializing: provider=${ provider } endpoint=${ endpoint } ` ,
@@ -39,8 +53,8 @@ export function getBucketProvisionerConnection(): StorageConnectionConfig {
3953 connectionConfig = {
4054 provider : ( provider as StorageConnectionConfig [ 'provider' ] ) || 'minio' ,
4155 region : awsRegion || 'us-east-1' ,
42- accessKeyId : awsAccessKey ! ,
43- secretAccessKey : awsSecretKey ! ,
56+ accessKeyId : awsAccessKey ,
57+ secretAccessKey : awsSecretKey ,
4458 ...( endpoint ? { endpoint, forcePathStyle : true } : { } ) ,
4559 } ;
4660
0 commit comments