aws-samples / aws-samples/amazon-textract-code-samples

InvalidParameterException: Request has invalid parameters when using startDocumentAnalysis

オープン
#58 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Jupyter Notebook
スター
449
フォーク
262
PR マージ指標
30日以内にマージされた PR はありません

説明

**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. (/Users/arunroot/Documents/mark93/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

関連するエントリポイントは、issue に示されている startDocumentAnalysis 呼び出しであり、特に追加された NotificationChannel ブロックです。まず、AWS SDK のリクエストパラメータと指定された role および topic の値が、文書化された API 要件を満たしているか確認してください。InvalidParameterException なしでリクエストを再現し、受け入れられる設定を文書化できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
aws, node.js
領域
backend, cloud
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
28/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。