-
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
UserPool: incorrect id #25839
Comments
This seems like it behaves correctly to me: Code: const userPool = cognito.UserPool.fromUserPoolId(this, 'UserPool', 'myid');
console.log(userPool.userPoolId);
console.log(userPool.userPoolArn); Output:
|
Are you sure this is correct? I expected the id, not the name. If you open AWS Cognito and check the id it will give you something like: |
I'm supplying |
Yes, if your id looks like that, then that is what you need to provide? These methods aren't looking anything up, I'm not sure if you're expecting that to be the case or not. The method asks for you to provide the ID because it can't know it, so please provide the ID and then it will work right |
|
No, I still think it is not right. You are showing the CDK (CloudFormation) id, not the UserPool id. So I fetch the User Pool by CloudFormation id and expect that the id of the User Pool = the id of the User Pool. The same is true for the ARN. Take a second look at your example, rename the id and it should be clear to you it isn't returning the User Pool id, but the CloudFormation id. @peterwoodworth also compare the uploaded image with the results I got. Should be clear that the UserPool.fromUserPoolId method is returning incorrect values. So, in my case, after I call 'UserPool.fromUserPoolId' and print the id and arn, it is returning the name ('dev-xxx-customer') instead of 'eu-central-1_xxxx'. Also in the arn, the name is used instead of the id (probably because they are correctly using the id, but it is mapped to the name). |
That's not how this works, there is no lookup occurring. You need to supply the value of the id yourself in the third argument of |
So why do I get my User Pool then? I know the id that I provided to create the User Pool, not the User Pool id. I am able to fetch the User Pool by the id I created myself. Those are different things. I expect a not found exception when I provided an invalid id, right? I am also seeing the name of the user pool after I invoked |
You would want to import your user pool if you need to pass it into a construct that accepts an If you can't manually provide the ID for the user pool and need to fetch it programmatically, you shouldn't do this during synth, and should instead do this with a script that writes to a file before running synth, and have synth read the contents of that file. See the section |
Describe the bug
In order to allow my Lambda to create a Cognito user I have to add an action. I do this by using:
Looking in the console it prints:
arn:aws:cognito-idp:<region>:<account>:userpool/dev-user-pool
I think this is incorrect, because the last part should be the id instead of the name.
The userPoolId is also set to the user pool name instead of the id. Probably a mapping is incorrect.
Expected Behavior
Return the correct arn (userPoolId should be the id, not the name).
Current Behavior
The arn includes the user pool name instead of the id
Reproduction Steps
Possible Solution
Fix mapping (id should be the id, not the name)
Additional Information/Context
No response
CDK CLI Version
2.82.0
Framework Version
No response
Node.js Version
v18.15.0
OS
Mac
Language
Typescript
Language Version
4.9.4
Other information
No response
The text was updated successfully, but these errors were encountered: