diff --git a/lambdas/handlers/edge_presign_handler.py b/lambdas/handlers/edge_presign_handler.py index 3863af65b..81beae27d 100644 --- a/lambdas/handlers/edge_presign_handler.py +++ b/lambdas/handlers/edge_presign_handler.py @@ -15,16 +15,19 @@ @handle_edge_exceptions @validate_s3_request def lambda_handler(event, context): - request: dict = event["Records"][0]["cf"]["request"] - logger.info("Edge received S3 request") + try: + request: dict = event["Records"][0]["cf"]["request"] + logger.info("Edge received S3 request") - edge_presign_service = EdgePresignService() - request_values: dict = edge_presign_service.filter_request_values(request) - edge_presign_service.use_presign(request_values) + edge_presign_service = EdgePresignService() + request_values: dict = edge_presign_service.filter_request_values(request) + edge_presign_service.use_presign(request_values) - forwarded_request: dict = edge_presign_service.update_s3_headers( - request, request_values - ) + forwarded_request: dict = edge_presign_service.update_s3_headers( + request, request_values + ) - logger.info("Edge forwarding S3 request") - return forwarded_request + logger.info("Edge forwarding S3 request") + return forwarded_request + except Exception as e: + logger.error(e) diff --git a/lambdas/requirements/requirements_edge_lambda.txt b/lambdas/requirements/requirements_edge_lambda.txt index e425bdf35..fa63b687b 100644 --- a/lambdas/requirements/requirements_edge_lambda.txt +++ b/lambdas/requirements/requirements_edge_lambda.txt @@ -3,5 +3,4 @@ boto3==1.35.3 botocore==1.35.3 pydantic==2.8.2 PyJWT==2.9.0 -inflection==0.5.1 -fhir.resources[xml]==7.1.0 \ No newline at end of file +inflection==0.5.1 \ No newline at end of file diff --git a/lambdas/services/edge_presign_service.py b/lambdas/services/edge_presign_service.py index cab057619..c39f4a44b 100644 --- a/lambdas/services/edge_presign_service.py +++ b/lambdas/services/edge_presign_service.py @@ -20,6 +20,7 @@ def __init__(self): self.table_name_ssm_param = "EDGE_REFERENCE_TABLE" def use_presign(self, request_values: dict): + logger.info("use presign") uri: str = request_values["uri"] querystring: str = request_values["querystring"] domain_name: str = request_values["domain_name"] @@ -35,6 +36,7 @@ def use_presign(self, request_values: dict): def attempt_presign_ingestion(self, uri_hash: str, domain_name: str) -> None: try: + logger.info(f"attempting presign ingestion for {domain_name}") environment = self.filter_domain_for_env(domain_name) logger.info(f"Environment found: {environment}") base_table_name: str = self.ssm_service.get_ssm_parameter( diff --git a/lambdas/utils/error_response.py b/lambdas/utils/error_response.py index dc37fdca5..daec0646d 100644 --- a/lambdas/utils/error_response.py +++ b/lambdas/utils/error_response.py @@ -1,6 +1,6 @@ import json -from fhir.resources.R4B.operationoutcome import OperationOutcome, OperationOutcomeIssue +# from fhir.resources.R4B.operationoutcome import OperationOutcome, OperationOutcomeIssue class ErrorResponse: @@ -18,14 +18,14 @@ def create(self) -> str: } ) - def create_error_fhir_response(self) -> str: - operation_outcome = OperationOutcome.construct() - operation_outcome.issue = list() - issue = OperationOutcomeIssue.construct( - code=self.err_code, details=self.message, severity="error" - ) - operation_outcome.issue.append(issue) - return operation_outcome.json() + # def create_error_fhir_response(self) -> str: + # operation_outcome = OperationOutcome.construct() + # operation_outcome.issue = list() + # issue = OperationOutcomeIssue.construct( + # code=self.err_code, details=self.message, severity="error" + # ) + # operation_outcome.issue.append(issue) + # return operation_outcome.json() def __eq__(self, other): return self.err_code == other.err_code and self.message == other.message