0

I have an AWS Chime EnterpriseLWA account. I need to be able to create users in AWS Chime via the AWS Chime SDK.

I am using AWS Chime JavaScript SDK (@aws-sdk/client-chime) installed with NPM. All the functions like ListAccounts, SuspendUsers, InviteUsers, etc. works fine but when I try to use the CreateUser function, it fails and throws a BadRequestException as follows:

{ 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' }

Following is my code.

const createUserCommand = new awsChime.CreateUserCommand({
    AccountId: accountId, 
    Email: userEmail,
    UserType: 'PrivateUser',
    Username: 'test user'
  });  

const createUserResponse = await client.send(createUserCommand);
Sarmad
  • 303
  • 3
  • 16

0 Answers0