Hello all,
While using Amazon Rekognition APIs we are getting error as InvalidParameterException: Request has invalid parameters
when using CreateUserCommand
API.
Other few commands are working - eg: ListCollectionsCommand, ListUsersCommand
More details are as
- Using node v18.16.0 (npm v9.5.1)
- Using nestjs
- Using "@aws-sdk/client-rekognition": "^3.409.0",
Sample code as
import { RekognitionClient } from "@aws-sdk/client-rekognition";
import { CreateCollectionCommand, ListCollectionsCommand, CreateUserCommand, ListUsersCommand, } from "@aws-sdk/client-rekognition";
// Init client
this.rekognition = new RekognitionClient({
region: this.region,
credentials: {
secretAccessKey: this.secretAccessKey,
accessKeyId: this.accessKeyId,
},
});
// Call create user API
const createUserParams = {
CollectionId: collectionId,
UserId: userId,
ClientRequestToken: 'dev' + new Date().getTime().toString()
};
/*
Where input sent is as
{
CollectionId: 'test_dev',
UserId: '1',
ClientRequestToken: 'dev1694588820574'
}
*/
const createUserResponse = await this.rekognition.send(new CreateUserCommand(createUserParams));
Getting error as
InvalidParameterException: Request has invalid parameters
at de_InvalidParameterExceptionRes (src/node_modules/@aws-sdk/client-rekognition/dist-cjs/protocols/Aws_json1_1.js:4398:23)
at de_CreateUserCommandError (src/node_modules/@aws-sdk/client-rekognition/dist-cjs/protocols/Aws_json1_1.js:1034:25)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at src/node_modules/@smithy/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
at src/node_modules/@aws-sdk/client-rekognition/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:14:20
at src/node_modules/@smithy/middleware-retry/dist-cjs/retryMiddleware.js:27:46
at src/node_modules/@aws-sdk/client-rekognition/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26
at AwsRekognitionService.createUsersInCollection (src/src/services/aws-rekognition/aws-rekognition.service.ts:115:45)
at FaceIndexingService.indexRekognitionUsers (src/src/cron/faceIndexing.service.ts:214:4)
at CJ.<anonymous> (src/node_modules/@nestjs/schedule/dist/schedule.explorer.js:88:17) {
'$fault': 'client',
'$metadata': {
httpStatusCode: 400,
requestId: 'b4fef655-bfa7-4234-ad9b-bf4951088831',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
Code: 'InvalidParameterException',
Logref: undefined,
__type: 'InvalidParameterException'
}
- Tried with AWS SDK 2 and 3 - for both - getting same error
- Tried passing/not passing ClientRequestToken - for both - getting same error
Any help will be highly appreciated.
Thank you.
Could you share the account Id, region and timestamp for this call to troubleshoot what we received at the service end?
@Venkat is it safe to share account ID here?