Skip to content

Commit da79f55

Browse files
Fix compatibility with cdk<2.167.0 (#99)
2 parents da0f16d + a7a9115 commit da79f55

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bin/cdklocal

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ const patchProviderCredentials = (provider) => {
161161
const result = await origConstr(options);
162162
result.sdkOptions = result.sdkOptions || {}; // legacy
163163
await setSdkOptions(result.sdkOptions); // legacy
164-
result.requestHandler.endpoint = localEndpoint;
165-
result.requestHandler.forcePathStyle = true;
164+
// >= 2.167.0
165+
if (result.requestHandler) {
166+
result.requestHandler.endpoint = localEndpoint;
167+
result.requestHandler.forcePathStyle = true;
168+
}
166169
return result;
167170
};
168171

@@ -372,7 +375,8 @@ const patchSdkProvider = (provider, SDK) => {
372375
provider.SdkProvider.prototype[methodName] = async function methFunc(...args) {
373376
const localEndpoint = await getLocalEndpoint();
374377

375-
if (!sdkOverwritten) {
378+
// patch for >= 2.167.0
379+
if (!sdkOverwritten && this.requestHandler) {
376380
// the goal is to support `SdkProvider.withAssumedRole`
377381
// since it instantiates a different client (i.e. not from the SDK class)
378382
this.requestHandler.endpoint = localEndpoint;

0 commit comments

Comments
 (0)