Skip to content

Commit

Permalink
Fix compatibility with cdk<2.167.0 (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikschubert authored Dec 5, 2024
2 parents da0f16d + a7a9115 commit da79f55
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bin/cdklocal
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ const patchProviderCredentials = (provider) => {
const result = await origConstr(options);
result.sdkOptions = result.sdkOptions || {}; // legacy
await setSdkOptions(result.sdkOptions); // legacy
result.requestHandler.endpoint = localEndpoint;
result.requestHandler.forcePathStyle = true;
// >= 2.167.0
if (result.requestHandler) {
result.requestHandler.endpoint = localEndpoint;
result.requestHandler.forcePathStyle = true;
}
return result;
};

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

if (!sdkOverwritten) {
// patch for >= 2.167.0
if (!sdkOverwritten && this.requestHandler) {
// the goal is to support `SdkProvider.withAssumedRole`
// since it instantiates a different client (i.e. not from the SDK class)
this.requestHandler.endpoint = localEndpoint;
Expand Down

0 comments on commit da79f55

Please sign in to comment.