我正在尝试在aws上执行lambda以列出我的认知用户池中的用户。这是我在nodejs中的代码:
const queryStringParameters = event.queryStringParameters;
var paginationToken = '';
if ( queryStringParameters && queryStringParameters.paginationToken ) {
paginationToken = queryStringParameters.paginationToken;
}
var limit = '10';
if ( queryStringParameters && queryStringParameters.limit ) {
limit = queryStringParameters.limit;
}
var params = {};
if ( paginationToken != '' ) {
params = {
UserPoolId: userPoolId, /* required */
//Filter: 'STRING_VALUE',
Limit: limit,
PaginationToken: paginationToken
};
} else {
params = {
UserPoolId: userPoolId, /* required */
//Filter: 'STRING_VALUE',
Limit: limit,
PaginationToken: paginationToken
};
}
cognitoidentityserviceprovider.listUsers(params, function (err, data) {
if (err) {
response.code = "ERROR"
response.message = "Han ocurrido errores"
response.result = err
callback(null, {
statusCode: 500,
headers,
body: JSON.stringify(response)
})
}
response.code = "OK"
response.message = ""
response.result = data
callback(null, {
statusCode: 200,
headers,
body: JSON.stringify(response)
});
});
我正在邮递员上使用在其他调用中返回的paginationToken测试此lambda。返回此错误。
{
"code": "ERROR",
"message": "Han ocurrido errores",
"result": {
"message": "1 validation error detected: Value 'CAISlAIIARLtAQgDEugBAEZixxOnN/v8zMwVa6CHVhw64qYzvU6Iyb5RkRwGsNS eyJAbiI6IlBhZ2luYXRpb25Db250aW51YXRpb25EVE8iLCJuZXh0S2V5IjoiQUFBQUFBQUFCYnYwQVFFQnU0V1pTVlZ1U0FDU1JZODJ4Mk9lL2RxVFRXbVZ3a3RScGVwQXNQT2JTWnBsYm1ZN01ETm1OREk0WVRNdFlqRmxZeTAwT0RZeExUaGpObVF0WkRZeU1ETXlZamd5T1RNek93PT0iLCJwcmV2aW91c1JlcXVlc3RUaW1lIjoxNTY1ODQ1MzU5NTU3fRog0tB4u0ATjZVYBFSGxE llc8AXn2 tEFfFFohzHQmeyY=' at 'paginationToken' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\S]+",
"code": "InvalidParameterException",
"time": "2019-08-18T17:37:37.581Z",
"requestId": "acd206e0-006a-4208-b298-78d8cd8d770e",
"statusCode": 400,
"retryable": false,
"retryDelay": 12.077823285760259
}
}
我正在尝试:
的https:// {端点}的/ dev /用户/列表限制= 10&paginationToken = CAISlAIIARLtAQgDEugBAEZixxOnN / v8zMwVa6CHVhw64qYzvU6Iyb5RkRwGsNS + eyJAbiI6IlBhZ2luYXRpb25Db250aW51YXRpb25EVE8iLCJuZXh0S2V5IjoiQUFBQUFBQUFCYnYwQVFFQnU0V1pTVlZ1U0FDU1JZODJ4Mk9lL2RxVFRXbVZ3a3RScGVwQXNQT2JTWnBsYm1ZN01ETm1OREk0WVRNdFlqRmxZeTAwT0RZeExUaGpObVF0WkRZeU1ETXlZamd5T1RNek93PT0iLCJwcmV2aW91c1JlcXVlc3RUaW1lIjoxNTY1ODQ1MzU5NTU3fRog0tB4u0ATjZVYBFSGxE + llc8AXn2 + tEFfFFohzHQmeyY =