Skip to content

Conversation

@hablutzel1
Copy link
Contributor

Currently, when making a simple request like:

{
    "check_type": "caa",
    "domain_or_ip_target": ""
}

a failure occurs within the perspectives Lambda and the returned error response looks like this:

{
...
    "perspectives": [
        {
            "perspective_code": "eu-west-2",
...
                "errors": [
                    {
                        "error_type": "mpic_error:coordinator:remote_check",
                        "error_message": "The remote check failed to complete. - Check failed for perspective eu-west-2: 'body'"
                    }
                ],

Where the error doesn't provide too much useful information.

With this update, the full error details are provided, including the Lambda execution exception and stack trace:

{
...
    "perspectives": [
        {
            "perspective_code": "eu-west-2",
...
                "errors": [
                    {
                        "error_type": "mpic_error:coordinator:remote_check",
                        "error_message": "The remote check failed to complete. - Check failed for perspective eu-west-2: Lambda execution error: {\"errorMessage\": \"Invalid domain name: Empty domain\", \"errorType\": \"ValueError\", \"requestId\": \"6f89dbce-f259-4a7b-849f-9d1b1e36a29d\", \"stackTrace\": [\"  File \\\"/opt/python/lib/python3.11/site-packages/aws_lambda_powertools/middleware_factory/factory.py\\\", line 137, in wrapper\\n    response = middleware()\\n\", \"  File \\\"/opt/python/lib/python3.11/site-packages/aws_lambda_powertools/utilities/parser/parser.py\\\", line 119, in event_parser\\n    return handler(parsed_event, context, **kwargs)\\n\", \"  File \\\"/var/task/mpic_caa_checker_lambda_function.py\\\", line 84, in lambda_handler\\n    return get_handler().process_invocation(event)\\n\", \"  File \\\"/var/task/mpic_caa_checker_lambda_function.py\\\", line 34, in process_invocation\\n    caa_response = event_loop.run_until_complete(self.caa_checker.check_caa(caa_request))\\n\", \"  File \\\"/var/lang/lib/python3.11/asyncio/base_events.py\\\", line 654, in run_until_complete\\n    return future.result()\\n\", \"  File \\\"/opt/python/lib/python3.11/site-packages/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py\\\", line 88, in check_caa\\n    caa_request.domain_or_ip_target = DomainEncoder.prepare_target_for_lookup(caa_request.domain_or_ip_target)\\n\", \"  File \\\"/opt/python/lib/python3.11/site-packages/open_mpic_core/common_util/domain_encoder.py\\\", line 25, in prepare_target_for_lookup\\n    raise ValueError(f\\\"Invalid domain name: {str(e)}\\\")\\n\"]}"
                    }
                ],

Although returning the complete stack trace may seem excessive, I think it accelerates debugging and since this service is internal to the CAs, exposing detailed errors in responses might be considered safe.

@birgelee
Copy link
Member

@hablutzel1 this looks great thanks. I agree about the point of the service being internal to CAs justifying the full error response.

@birgelee birgelee merged commit 82211db into open-mpic:main Apr 10, 2025
1 check passed
@hablutzel1 hablutzel1 deleted the perspective-lambda-errors branch April 20, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants