Description
I'm encountering an InvalidParameterException: Request has invalid parameters error when attempting to use the startDocumentAnalysis method with AWS Textract in a Node.js application. The error occurs despite ensuring that all parameters are correctly specified.
Environment
- Node.js Version: 18.20.3
- AWS SDK Version: ^2.1548.0
- AWS Region: ap-south-1
Here's the code I'm using
public async startAnalyiseDocument(key: string) {
try {
const response = await this.textreact
.startDocumentAnalysis({
DocumentLocation: {
S3Object: {
Bucket: env.AWS_BUCKET_NAME as string,
Name: key as string,
},
},
FeatureTypes: [
"TABLES", "FORMS", "SIGNATURES"
],
NotificationChannel:{
RoleArn:env.AWS_ROLE_ARN as string,
SNSTopicArn: env.AWS_SNS_TOPIC_ARN as string,
},
})
.promise();
console.log('ERROR:',response.$response.error)
return response;
} catch (error) {
console.log("AWS_TXT:", error);
throw new Error(error);
}
}
Error Details
InvalidParameterException: Request has invalid parameters
at Request.extractError (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/protocol/json.js:80:27)
at Request.callListeners (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/arunroot/Documents/mark93r/node_modules/aws-sdk/lib/request.js:686:14)
at Request.transition (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/arunroot/Documents/mark93r/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/request.js:688:12)
at Request.callListeners (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
code: 'InvalidParameterException',
'[__type]': 'See error.__type for details.',
'[Message]': 'See error.Message for details.',
time: 2024-07-04T18:31:17.960Z,
requestId: 'd05e66d4-2b18-446e-938e-de9b56864963',
statusCode: 400,
retryable: false,
retryDelay: 79.76554747215391
}
Additional Information
- The
RoleArn and SNSTopicArn are correctly specified and the IAM role has the necessary permissions.
- Before implementing
NotificationChannel it was working fine.
Description
I'm encountering an InvalidParameterException: Request has invalid parameters error when attempting to use the startDocumentAnalysis method with AWS Textract in a Node.js application. The error occurs despite ensuring that all parameters are correctly specified.
Environment
Here's the code I'm using
Error Details
Additional Information
RoleArnandSNSTopicArnare correctly specified and the IAM role has the necessary permissions.NotificationChannelit was working fine.