-
Notifications
You must be signed in to change notification settings - Fork 634
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
When using AWS Cognito’s ListUsersCommand
with a filter on the email attribute, attempting to search with a prefix ending in @ (e.g., "email ^= "julian@""), no results are returned even if there are users with email addresses starting with [email protected]. However, appending an additional character after @ (e.g., "email ^= "julian@a""), does return results for users with email addresses that match this prefix.
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/client-cognito-identity-provider": "3.651.1
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
20
Reproduction Steps
1. Use AWS Cognito’s ListUsersCommand to search for users by email prefix in a specific User Pool.
2. Set the filter to match email addresses with a prefix ending in @, as shown below:
const response = await cognito.send(
new ListUsersCommand({
UserPoolId: "pool-id",
Filter: 'email ^= "julian@"'
})
);
- Observe the results of the command.
Observed Behavior
When executing the above code:
- No users are returned for the filter email ^= "julian@", even if users with matching email addresses exist in the User Pool.
- Adding a single character after the @ symbol in the filter (e.g., email ^= "julian@a") correctly returns users whose emails match the specified prefix.
Expected Behavior
The filter email ^= "julian@" should return all users with email addresses that start with julian@, regardless of what characters come after the @ symbol.
Possible Solution
The ListUsersCommand
filter logic in AWS Cognito should recognize and handle special characters such as @ in a prefix context, even if they appear at the end of the filter string. This would enable searching for email prefixes with special characters without requiring additional characters afterward.
Additional Information/Context
If we have a list of users like:
[email protected]
, [email protected]
, [email protected]
We may want to just look for julian@
to exclude the rest.