in src/commons/abstract_lambda.py [0:0]
def lambda_handler(self, event: dict, context: RequestContext
) -> LambdaOutput:
_LOG.info(f'Starting request: {context.aws_request_id}')
SP.environment_service.update(
{Env.INVOCATION_REQUEST_ID: context.aws_request_id}
)
# This is the only place where we print the event. Do not print it
# somewhere else
_LOG.debug('Incoming event')
_LOG.debug(json.dumps(hide_secret_values(event)))
try:
for processor in self.processors:
event = processor(event)
return self.handle_request(event=event, context=context)
except ApplicationException as e:
_LOG.warning(f'Application exception occurred: {e}')
return e.build()
except ModularException as e:
_LOG.warning('Modular exception occurred', exc_info=True)
return ResponseFactory(int(e.code)).message(e.content).build()
except Exception: # noqa
_LOG.exception('Unexpected exception occurred')
return ResponseFactory(
HTTPStatus.INTERNAL_SERVER_ERROR
).default().build()