Skip to content

Commit

Permalink
fix: credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
ServerlessLife committed May 4, 2024
1 parent 7c25333 commit b0fab18
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cdkResourcesDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { outputFolder } from "./constants.js";
import type { BundlingOptions } from "aws-cdk-lib/aws-lambda-nodejs";
import { BundlingType } from "./functionProps.js";
import { findAboveFolderWithAFile } from "./findAboveFolderWithAFile.js";
import { LlDebugger } from "./lldebugger.js";
import * as AwsCredentials from "./awsCredentials.js";

// this is global variable to store the data from the CDK code once it is executed
declare global {
Expand Down Expand Up @@ -404,8 +404,6 @@ async function getCdkEntryFile(cdkConfigPath: string) {
return entryFile;
}

let cloudFormationClient: CloudFormationClient;

async function getCloudFormationSdk() {
const {
CloudFormationClient,
Expand All @@ -420,10 +418,14 @@ async function getCloudFormationSdk() {
};
}

let cloudFormationClient: CloudFormationClient;

async function getCloudFormationClient() {
if (!cloudFormationClient) {
const { CloudFormationClient } = await getCloudFormationSdk();
cloudFormationClient = new CloudFormationClient({});
cloudFormationClient = new CloudFormationClient({
credentials: AwsCredentials.getCredentialsProvider(),
});
}
return cloudFormationClient;
}

0 comments on commit b0fab18

Please sign in to comment.