Skip to content

Commit

Permalink
fix compatibility with cdk<2.167.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikschubert committed Dec 4, 2024
1 parent da0f16d commit a7a9115
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

1 comment on commit a7a9115

@cj-christoph-gysin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dominikschubert Could you make a new release with this fix?

Please sign in to comment.