我有一个 AWS Chime EnterpriseLWA 账户。我需要能够通过 AWS Chime 开发工具包在 AWS Chime 中创建用户。
我正在使用与 NPM 一起安装的 AWS Chime JavaScript SDK (@aws-sdk/client-chime)。ListAccounts、SuspendUsers、InviteUsers 等所有函数都可以正常工作,但是当我尝试使用 CreateUser 函数时,它会失败并抛出 BadRequestException,如下所示:
{ BadRequestException: Service received a bad request
at deserializeAws_restJson1CreateUserCommandError (E:\Projects\AWS\chime\node_modules\@aws-sdk\client-chime\dist\cjs\protocols\Aws_restJson1.js:9349:41)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'BadRequestException',
'$fault': 'client',
'$metadata':
{ httpStatusCode: 400,
requestId: '66d331ac-f32c-432f-8694-596c019385f1',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0 },
Code: 'BadRequest' }
以下是我的代码。
const createUserCommand = new awsChime.CreateUserCommand({
AccountId: accountId,
Email: userEmail,
UserType: 'PrivateUser',
Username: 'test user'
});
const createUserResponse = await client.send(createUserCommand);