diff --git a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts b/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts index 409f63b1e..d6236e4ed 100644 --- a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts +++ b/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts @@ -94,7 +94,9 @@ export const identityAwsAuthServiceFactory = ({ const headers: TAwsGetCallerIdentityHeaders = JSON.parse(Buffer.from(iamRequestHeaders, "base64").toString()); const body: string = Buffer.from(iamRequestBody, "base64").toString(); - const region = headers.authorization ? awsRegionFromHeader(headers.Authorization || headers.authorization) : null; + + const authHeader = headers.Authorization || headers.authorization; + const region = authHeader ? awsRegionFromHeader(authHeader) : null; if (!isValidAwsRegion(region)) { throw new BadRequestError({ message: "Invalid AWS region" }); diff --git a/docs/documentation/platform/identities/aws-auth.mdx b/docs/documentation/platform/identities/aws-auth.mdx index 08c28cbd4..ab2b5cd3a 100644 --- a/docs/documentation/platform/identities/aws-auth.mdx +++ b/docs/documentation/platform/identities/aws-auth.mdx @@ -334,7 +334,7 @@ access the Infisical API using the AWS Auth authentication method. const credentials = await fromNodeProviderChain()(); if (!credentials.accessKeyId || !credentials.secretAccessKey) { - throw new InfisicalSDKError("Credentials not found"); + throw new Error("Credentials not found"); } const iamRequestURL = `https://sts.${region}.amazonaws.com/`; @@ -379,7 +379,7 @@ access the Infisical API using the AWS Auth authentication method. const { data: { accessToken } - } = await axios.post<{ accessToken: string }>("https://app.infisical.com/v1/auth/aws-auth/login", { + } = await axios.post<{ accessToken: string }>("https://app.infisical.com/api/v1/auth/aws-auth/login", { ...iamRequest, identityId: "" });