Skip to content

Commit 5464abe

Browse files
ShadowCat567aws-amplify-botVieltojarvi
authored
fix: Userpool does not exist (#14262)
* fix: cognito provider * chore: also update geo * fix: v3 style credentials * chore: remove client destructuring, not needed --------- Co-authored-by: aws-amplify-bot <aws@amazon.com> Co-authored-by: Vieltojarvi <lvielto@amazon.com>
1 parent 38faaef commit 5464abe

4 files changed

Lines changed: 30 additions & 8 deletions

File tree

packages/amplify-provider-awscloudformation/src/aws-utils/CognitoUserPoolService.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,28 @@ import {
2323
ListUserPoolsRequest,
2424
} from '@aws-sdk/client-cognito-identity-provider';
2525
import { ICognitoUserPoolService } from '@aws-amplify/amplify-util-import';
26-
import { loadConfiguration } from '../configuration-manager';
26+
import { AwsSecrets, loadConfiguration } from '../configuration-manager';
2727
import { fileLogger } from '../utils/aws-logger';
2828
import { pagedAWSCall } from './paged-call';
2929
const logger = fileLogger('CognitoUserPoolService');
3030

3131
export const createCognitoUserPoolService = async (context: $TSContext, options: $TSAny): Promise<CognitoUserPoolService> => {
32-
let credentials = {};
32+
let credentials: AwsSecrets = {};
3333

3434
try {
3535
credentials = await loadConfiguration(context);
3636
} catch (e) {
3737
// could not load credentials
3838
}
3939

40-
const cognito = new CognitoIdentityProviderClient({ ...credentials, ...options });
40+
const cognito = new CognitoIdentityProviderClient({
41+
...options,
42+
credentials: {
43+
accessKeyId: credentials.accessKeyId,
44+
secretAccessKey: credentials.secretAccessKey,
45+
},
46+
region: credentials.region,
47+
});
4148

4249
return new CognitoUserPoolService(cognito);
4350
};

packages/amplify-provider-awscloudformation/src/aws-utils/IdentityPoolService.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,26 @@ import {
1010
ListIdentityPoolsResponse,
1111
ListIdentityPoolsInput,
1212
} from '@aws-sdk/client-cognito-identity';
13-
import { loadConfiguration } from '../configuration-manager';
13+
import { AwsSecrets, loadConfiguration } from '../configuration-manager';
1414
import { pagedAWSCall } from './paged-call';
1515

1616
export const createIdentityPoolService = async (context: $TSContext, options: $TSAny): Promise<IdentityPoolService> => {
17-
let credentials = {};
17+
let credentials: AwsSecrets = {};
1818

1919
try {
2020
credentials = await loadConfiguration(context);
2121
} catch (e) {
2222
// could not load credentials
2323
}
2424

25-
const cognitoIdentity = new CognitoIdentityClient({ ...credentials, ...options });
25+
const cognitoIdentity = new CognitoIdentityClient({
26+
...options,
27+
credentials: {
28+
accessKeyId: credentials.accessKeyId,
29+
secretAccessKey: credentials.secretAccessKey,
30+
},
31+
region: credentials.region,
32+
});
2633

2734
return new IdentityPoolService(cognitoIdentity);
2835
};

packages/amplify-provider-awscloudformation/src/aws-utils/aws-cognito-client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ export class CognitoUserPoolClientProvider {
2424

2525
constructor(creds: AwsSecrets, options = {}) {
2626
const clientConfig: CognitoIdentityProviderClientConfig = {
27-
...creds,
2827
...options,
28+
credentials: {
29+
accessKeyId: creds.accessKeyId,
30+
secretAccessKey: creds.secretAccessKey,
31+
},
32+
region: creds.region,
2933
requestHandler: new NodeHttpHandler({
3034
httpAgent: proxyAgent(),
3135
httpsAgent: proxyAgent(),

packages/amplify-provider-awscloudformation/src/aws-utils/aws-location-service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ export class LocationService {
2323

2424
private constructor(cred: AwsSecrets, options = {}) {
2525
this.client = new LocationClient({
26-
...cred,
2726
...options,
27+
credentials: {
28+
accessKeyId: cred.accessKeyId,
29+
secretAccessKey: cred.secretAccessKey,
30+
},
31+
region: cred.region,
2832
requestHandler: new NodeHttpHandler({
2933
httpAgent: proxyAgent(),
3034
httpsAgent: proxyAgent(),

0 commit comments

Comments
 (0)