-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-cdk-aws-cognito-identitypool-alpha: IdentityPoolProviderUrl.user_pool cant handle imported userpools #30304
aws-cdk-aws-cognito-identitypool-alpha: IdentityPoolProviderUrl.user_pool cant handle imported userpools #30304
Comments
@SpielerNogard Good morning. I tried to reproduce the issue in import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as cognito from 'aws-cdk-lib/aws-cognito';
import * as cognitoidp from '@aws-cdk/aws-cognito-identitypool-alpha';
export class TypescriptStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const userPool = cognito.UserPool.fromUserPoolArn(this, 'CognitoUserPool', 'arn:aws:cognito-idp:<<REGION>>:<<ACCOUNT-ID>>:userpool/<<REGION>>_<<SOME-ID>>');
const userPoolClient = cognito.UserPoolClient.fromUserPoolClientId(this, 'UserPoolClientId', '<<APP-CLIENT-ID>>');
const identityPool = new cognitoidp.IdentityPool(this, 'IdentityPool', {
identityPoolName: 'IdentityPool',
authenticationProviders: {
userPools: [
new cognitoidp.UserPoolAuthenticationProvider({
userPool: userPool,
userPoolClient: userPoolClient
})
]
},
roleMappings: [
{
mappingKey: 'cognito',
providerUrl: cognitoidp.IdentityPoolProviderUrl.userPool(userPool, userPoolClient),
useToken: true
}
],
allowUnauthenticatedIdentities: false
});
}
} The Visual Studio Code IDE itself flagged the error Upon investigating further:
I will discuss this with the team for any workarounds. Thanks, |
Thanks for the answer. Thats bad, since we cant recreate the userpool in the stack, because we have too much users, and this error interrupts us also with the plan to go to python3.12 Hope its possible to find a workaround 🤞 |
That's correct! But if we look at its implementation: aws-cdk/packages/@aws-cdk/aws-cognito-identitypool-alpha/lib/identitypool.ts Lines 160 to 163 in c3003ab
we just need the aws-cdk/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts Lines 757 to 803 in c3003ab
To fix this bug:
|
I'll take this. |
Hi @sakurai-ryo Please note adding new attributes to IUserPool would be a breaking change and we should avoid that as aws-cognito is a stable module. I am requesting input from our maintainers for this issue so we'll know how to address that. |
Just one point of clarification: adding attributes is not a breaking change. The proposed change is OK on our end. |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
Our Userpool and clients are created outside our application. We now want to attach a identity pool to this userpool. Today i updated from version
aws-cdk-aws-cognito-identitypool-alpha==2.96.0a0
toaws-cdk-aws-cognito-identitypool-alpha == 2.141.0a0
and changed the role_mappings accordingly. While runningcdk synth
i get the error:TypeError: type of argument user_pool must be aws_cdk.aws_cognito.UserPool; got jsii._reference_map.InterfaceDynamicProxy instead
Expected Behavior
Since the
UserPoolAuthenticationProvider
is able to handle imported userpools and clients, theIdentityPoolProviderUrl
should also beCurrent Behavior
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.142.1 (build ed4e152)
Framework Version
No response
Node.js Version
v21.1.0
OS
Mac OS 14.5 (23F79)
Language
Python
Language Version
3.8.18 3.12.0 3.11.6
Other information
No response
The text was updated successfully, but these errors were encountered: