Using the following AWS Lambda-based app client, I'm trying to list all users from my Cognito user pool.
let AWS = require('aws-sdk')
const COGNITO_CLIENT = new AWS.CognitoIdentityServiceProvider()
COGNITO_CLIENT.listUsers({
UserPoolId: 'MyUserPoolId',
AttributesToGet: ['default_attribute', 'custom:my_attribute']
}, callback)
Everything works fine when querying for all attributes by default (AttributesToGet: [] // or excluding this field altogether). However, when targeting custom attributes, the InvalidParameterException is raised. This is using the Amazon SDK for Node.js.
Targeting default attributes are allowed though:
AttributesToGet: ['email', 'name', /* other non-custom */]