-
Notifications
You must be signed in to change notification settings - Fork 557
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
AdminLinkProviderForUserCommand throws InvalidParameterException incorrectly #5281
Comments
Hi @ignaciolarranaga , This is an interesting issue, that I think stems from an edge case in service side error handling. Running your code once resulted in a successful link. After that, running the same bit of code again results in this wrong error. $ node sample.mjs
{
'$metadata': {
httpStatusCode: 200,
requestId: 'REDACTED',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
}
$ node sample.mjs
InvalidParameterException: Invalid SourceUser: Cognito users with a username/password may not be passed in as a SourceUser, only as a DestinationUser
at de_InvalidParameterExceptionRes (/Users/rvaknin/test_folder/5281/node_modules/@aws-sdk/client-cognito-identity-provider/dist-cjs/protocols/Aws_json1_1.js:6356:23)
at de_AdminLinkProviderForUserCommandError (/Users/rvaknin/test_folder/5281/node_modules/@aws-sdk/client-cognito-identity-provider/dist-cjs/protocols/Aws_json1_1.js:1456:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /Users/rvaknin/test_folder/5281/node_modules/@smithy/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
at async /Users/rvaknin/test_folder/5281/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:14:20
at async /Users/rvaknin/test_folder/5281/node_modules/@smithy/middleware-retry/dist-cjs/retryMiddleware.js:27:46
at async /Users/rvaknin/test_folder/5281/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26
at async file:///Users/rvaknin/test_folder/5281/sample.mjs:29:16 {
'$fault': 'client',
'$metadata': {
httpStatusCode: 400,
requestId: 'REDACTED',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
__type: 'InvalidParameterException'
} In an ideal world the service would return something like "4xx - the user is already linked", but this is probably an oversight in error handling. This means that the your code is being called twice with the same input. Let me know if you need anything else. |
Thanks @RanVaknin , I didn't noticed the code can be called twice. Will research to find out more. |
This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Checkboxes for prior research
Describe the bug
The following sequence causes the AdminLinkProviderForUserCommand command to throw InvalidParameterException: "Invalid SourceUser: Cognito users with a username/password may not be passed in as a SourceUser, only as a DestinationUser" while really parameters are passed correctly (indeed the linking is executed).
SDK version number
@aws-sdk/client-cognito-identity-provider@3.421.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Lambda with node 18.x
Reproduction Steps
Observed Behavior
The user is linked but an exception is thrown
Expected Behavior
The user is linked but NO exception is thrown
Possible Solution
No response
Additional Information/Context
Example stack trace:
Example Payload:
The text was updated successfully, but these errors were encountered: