Skip to content

Commit fda8dd2

Browse files
authored
fix(gen2-migration): add awsRegion to userPoolConfig in additional auth providers (#14710)
* fix(cli-internal): add awsRegion to userPoolConfig in additional auth providers The DataGenerator's contributeAdditionalAuthProviders method was generating userPoolConfig with only userPoolId for AMAZON_COGNITO_USER_POOLS auth providers. This adds the missing awsRegion property (backend.auth.stack.region) so the generated backend.ts matches the expected output. Verified with existing data.generator.test.ts — all 14 tests pass. --- Prompt: I've added this line in the mood-board snapshot. This needs to be added whenever there is a userPool additional auth provider - awsRegion: backend.auth.stack.region, * chore: update snapshot manually * chore: update snapshots
1 parent 4f88963 commit fda8dd2

File tree

5 files changed

+16
-0
lines changed
  • amplify-migration-apps
    • backend-only/_snapshot.post.generate/amplify
    • mood-board/_snapshot.post.generate/amplify
    • product-catalog/_snapshot.post.generate/amplify
    • project-boards/_snapshot.post.generate/amplify
  • packages/amplify-cli/src/commands/gen2-migration/generate/amplify/data

5 files changed

+16
-0
lines changed

amplify-migration-apps/backend-only/_snapshot.post.generate/amplify/backend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cfnGraphqlApi.additionalAuthenticationProviders = [
3838
authenticationType: 'AMAZON_COGNITO_USER_POOLS',
3939
userPoolConfig: {
4040
userPoolId: backend.auth.resources.userPool.userPoolId,
41+
awsRegion: backend.auth.stack.region,
4142
},
4243
},
4344
];

amplify-migration-apps/mood-board/_snapshot.post.generate/amplify/backend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ cfnGraphqlApi.additionalAuthenticationProviders = [
4242
authenticationType: 'AMAZON_COGNITO_USER_POOLS',
4343
userPoolConfig: {
4444
userPoolId: backend.auth.resources.userPool.userPoolId,
45+
awsRegion: backend.auth.stack.region,
4546
},
4647
},
4748
];

amplify-migration-apps/product-catalog/_snapshot.post.generate/amplify/backend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ cfnGraphqlApi.additionalAuthenticationProviders = [
4545
authenticationType: 'AMAZON_COGNITO_USER_POOLS',
4646
userPoolConfig: {
4747
userPoolId: backend.auth.resources.userPool.userPoolId,
48+
awsRegion: backend.auth.stack.region,
4849
},
4950
},
5051
];

amplify-migration-apps/project-boards/_snapshot.post.generate/amplify/backend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cfnGraphqlApi.additionalAuthenticationProviders = [
3838
authenticationType: 'AMAZON_COGNITO_USER_POOLS',
3939
userPoolConfig: {
4040
userPoolId: backend.auth.resources.userPool.userPoolId,
41+
awsRegion: backend.auth.stack.region,
4142
},
4243
},
4344
];

packages/amplify-cli/src/commands/gen2-migration/generate/amplify/data/data.generator.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ export class DataGenerator implements Planner {
149149
),
150150
),
151151
);
152+
userPoolConfigProps.push(
153+
factory.createPropertyAssignment(
154+
'awsRegion',
155+
factory.createPropertyAccessExpression(
156+
factory.createPropertyAccessExpression(
157+
factory.createPropertyAccessExpression(factory.createIdentifier('backend'), factory.createIdentifier('auth')),
158+
factory.createIdentifier('stack'),
159+
),
160+
factory.createIdentifier('region'),
161+
),
162+
),
163+
);
152164
}
153165
props.push(factory.createPropertyAssignment('userPoolConfig', factory.createObjectLiteralExpression(userPoolConfigProps, true)));
154166
}

0 commit comments

Comments
 (0)