[Python] LocalStackCloud dozzle viewer throws python errors despite the fact that a C# -based...

Discussão em 'Python' iniciado por Stack, Agosto 27, 2025.

  1. Stack

    Stack Membro Participativo

    Here is the info about the technologies that I'm using:

    • LocalStack CLI 4.6.0
    • OS Name     Microsoft Windows 11 Enterprise
    • Docker Desktop 4.43.2 (199162)
    • aws --version aws-cli/2.17.0 Python/3.11.8 Windows/10 exe/AMD64
    • awslocal --version aws-cli/1.41.14 Python/3.11.5 Windows/10 botocore/1.39.14
    • samlocal --version SAM CLI, version 1.142.1
    • Microsoft Visual Studio Enterprise 2022 (64-bit)
    • .NET 6.0
    • C# 10

    At our work, we do deploy applications to the Amazon AWS Cloud However, we want to locally code our C# .NET 6.0-based AWS applications on our work computers using LocalStackCloud ( https://www.localstack.cloud/ ). We deploy C#-based AWS Serverless Lambda projects to Localstackcloud that is installed on our work laptops.

    Here is our docker compose yml file that contains configuration info for the localstackcloud container instance that we use:

    services:
    localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
    image: localstack/localstack
    ports:
    - "127.0.0.1:4566:4566" # LocalStack Gateway
    - "127.0.0.1:4510-4559:4510-4559" # external services port range
    - "127.0.0.1:5678:5678" # Lambda debug port
    environment:
    - SERVICES=iam,cloudformation,sqs,sns,s3,ssm,stepfunctions,lambda,events,cloudwatch,ec2
    # - DEBUG=${DEBUG:-1}
    - DEBUG=1
    - AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-eu-west-1}
    - LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT=30 # increase the Lambda environment startup timeout (default is 10 seconds)
    - LAMBDA_DEBUG_PORT=5678
    - DISABLE_EVENTS=1 # This will consequentially also Stop Telemetry
    - LAMBDA_EXECUTOR=docker
    volumes:
    - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
    - "/var/run/docker.sock:/var/run/docker.sock"
    #Local Log viewer
    localstack-logviewer:
    container_name: localstack-logviewer
    image: amir20/dozzle:latest
    restart: unless-stopped
    env_file:
    - env.local
    environment:
    - DOZZLE_NO_ANALYTICS=true
    - DOZZLE_HOSTNAME=Local-Cloud
    - DOZZLE_ENABLE_ACTIONS=true
    - DOZZLE_ENABLE_SHELL=true
    - DOZZLE_TIMEOUT=10s
    - DOZZLE_LEVEL=trace
    deploy:
    resources:
    limits:
    cpus: "0.25"
    memory: 250M
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    ports:
    - ${PORT_LOGGER}:8080
    healthcheck:
    test: ["CMD", "/dozzle", "healthcheck"]
    interval: 3s
    timeout: 30s
    retries: 5
    start_period: 30s


    Here are the logs that shows up in the localstack dozzle viewer:


    2025-08-27T18:47:48.025 ERROR --- [-functhread9] l.s.l.e.esm_event_processo : Unhandled exception while processing Lambda event source mapping (ESM) events [{'messageId': '22746974-e523-47df-82ad-699777d98491', 'receiptHandle': 'MTMwYzdhMzItNTZjNC00YzM4LWE1YjMtMWIwYmU5MzkxMzAyIGFybjphd3M6c3FzOmV1LXdlc3QtMTowMDAwMDAwMDAwMDA6c3RhY2stb2Jlcy1lbWFpbC1jb25zdHJ1Y3Rvci1sLU9iZXNFbWFpbENvbnN0cnVjdG9yU1FTLWI5Mzc4YWMxIDIyNzQ2OTc0LWU1MjMtNDdkZi04MmFkLTY5OTc3N2Q5ODQ5MSAxNzU2MzIwNDM3LjY5MDI5NDc=', 'body': '{"applicationId": "Base Application", "templateId": "Base yada Template", "from": "blah@blah.com", "to": ["yada@Blah.com], "cc": [], "subject": "AWS Serverless PDF test ", "templateParameters": [{"parameter": "ContactUsURL", "value": "https://yada.blah.yada.com?ntactUs=true"}], "customArgs": [], "s3Attachments": [{"filename": "blahBlah.pdf", "bucketName": "yada-send-attachment-lcl", "ContentType": "application/pdf", "objectKey": "TestyadaAsPDF.pdf"}], "customParametersJson": ""}', 'attributes': {'SenderId': '000000000000', 'SentTimestamp': '1756320133454', 'ApproximateReceiveCount': '2', 'ApproximateFirstReceiveTimestamp': '1756320136047'}, 'messageAttributes': {}, 'md5OfBody': '0e25d1aad6b304171cde05004332bb7e', 'eventSourceARN': 'arn:aws:sqs:eu-west-1:000000000000:stack-yada-yada-constructor-l-yadayadaConstructorSQS-b9378ac1', 'eventSource': 'aws:sqs', 'awsRegion': 'eu-west-1'}] for ESM with execution id b6b9f600-e87f-4535-9928-a90ffa61cd6a Traceback (most recent call last): File "/opt/code/localstack/localstack-core/localstack/services/lambda_/event_source_mapping/esm_event_processor.py", line 57, in process_events_batch self.process_target_stage(events) File "/opt/code/localstack/localstack-core/localstack/services/lambda_/event_source_mapping/esm_event_processor.py", line 113, in process_target_stage payload = self.sender.send_events(events) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/services/lambda_/event_source_mapping/senders/lambda_sender.py", line 59, in send_events invoke_result = self.target_client.invoke( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/client.py", line 601, in api_call return self.make_api_call(operation_name, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/context.py", line 123, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/client.py", line 1074, in make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.ServiceException: An error occurred (ServiceException) when calling the Invoke operation (reached max retries: 0): [9787083b-ba9a-4110-bf68-9112e8eec250] Timeout while starting up lambda environment for function stack-yada-yada-constructor-lcl-yadayadaConstructor-9fd24bb3:prod 2025-08-27T18:47:48.026 WARN --- [-functhread9] l.s.l.e.pollers.sqs_poller : Polling or batch processing failed: An error occurred (ServiceException) when calling the Invoke operation (reached max retries: 0): [9787083b-ba9a-4110-bf68-9112e8eec250] Timeout while starting up lambda environment for function stack-yada-yada-constructor-lcl-yadayadaConstructor-9fd24bb3:prod Traceback (most recent call last): File "/opt/code/localstack/localstack-core/localstack/services/lambda/event_source_mapping/pollers/sqs_poller.py", line 186, in poll_events self.handle_messages(message_batch) File "/opt/code/localstack/localstack-core/localstack/services/lambda/event_source_mapping/pollers/sqs_poller.py", line 234, in handle_messages self.processor.process_events_batch(enriched_events) File "/opt/code/localstack/localstack-core/localstack/services/lambda/event_source_mapping/esm_event_processor.py", line 98, in process_events_batch raise e File "/opt/code/localstack/localstack-core/localstack/services/lambda_/event_source_mapping/esm_event_processor.py", line 57, in process_events_batch self.process_target_stage(events) File "/opt/code/localstack/localstack-core/localstack/services/lambda_/event_source_mapping/esm_event_processor.py", line 113, in process_target_stage payload = self.sender.send_events(events) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/services/lambda_/event_source_mapping/senders/lambda_sender.py", line 59, in send_events invoke_result = self.target_client.invoke( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/client.py", line 601, in _api_call return self._make_api_call(operation_name, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/context.py", line 123, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/botocore/client.py", line 1074, in _make_api_call raise error_class(parsed_response, operation_name)
    ​

    Here is my C# AWS Lambda Function's handler code:


    public void Handler(SQSEvent sqsEventInstance, ILambdaContext context) {

    try
    {


    _businessLogic.Execute(sqsEventInstance);

    }
    catch (Exception e)
    {

    context.Logger.LogCritical(e.ToString());
    context.Logger.LogCritical(e.StackTrace);
    context.Logger.LogCritical(e.InnerException?.ToString());


    } }​

    The problem is that the aforementioned python errors that are thrown is quite vague, high-level and cryptic.

    Furthermore, I'm throwing C# exception error stack traces, therefore, why are the C# exception error message Not showing up in the localstack dozzle viewer?

    Continue reading...

Compartilhe esta Página