Last active
July 8, 2019 13:38
-
-
Save manchuck/c2e36f215104fd126c76a93bdc66ba41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchUsersFromCognito = async ( | |
cognitoService, | |
userPoolId, | |
limit = 60, | |
pageToken = null, | |
) => { | |
// Not documented in AWS docs but the max limit for this service is 60 | |
if (limit > 60 || limit < 1) { | |
throw new Error('Invalid range for limit'); | |
} | |
try { | |
return await cognitoService.listUsers({ | |
Limit: limit, | |
UserPoolId: userPoolId, | |
PaginationToken: pageToken, | |
}).promise(); | |
} catch (error) { | |
throw error; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment