diff --git a/backend/src/iac/backend-stack.ts b/backend/src/iac/backend-stack.ts index 6f6a7e0d..1d43cdfd 100644 --- a/backend/src/iac/backend-stack.ts +++ b/backend/src/iac/backend-stack.ts @@ -176,6 +176,31 @@ export class BackendStack extends cdk.Stack { }), ); + // Add Amazon Textract permissions for document analysis + taskRole.addToPolicy( + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: [ + 'textract:AnalyzeDocument', + 'textract:DetectDocumentText', + 'textract:GetDocumentAnalysis', + 'textract:StartDocumentAnalysis', + 'textract:StartDocumentTextDetection', + 'textract:GetDocumentTextDetection', + ], + resources: ['*'], // You may want to restrict this to specific resources in production + }), + ); + + // Add Amazon Bedrock permissions for model invocation + taskRole.addToPolicy( + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['bedrock:InvokeModel'], + resources: ['*'], + }), + ); + // Task Definition with explicit roles const taskDefinition = new ecs.FargateTaskDefinition( this, diff --git a/frontend/src/common/hooks/useTimeout.ts b/frontend/src/common/hooks/useTimeout.ts index 59147401..d890c9b4 100644 --- a/frontend/src/common/hooks/useTimeout.ts +++ b/frontend/src/common/hooks/useTimeout.ts @@ -4,7 +4,7 @@ import { useCallback, useEffect, useRef } from 'react'; * Custom hook for handling setTimeout with cleanup */ export const useTimeout = () => { - const timeoutRef = useRef(null); + const timeoutRef = useRef(null); // Clear the timeout when component unmounts or when called manually const clearTimeout = useCallback(() => {