[Python] Why does the `dict[key]` operation fail in AWS Lambda when created from a non-Amazon...

Discussão em 'Python' iniciado por Stack, Maio 3, 2025.

  1. Stack

    Stack Membro Participativo

    I have an image c created by AWS Imagebuilder that uses debian:bookworm-slim as the base, and then runs apt install -y --no-install-suggests texlive-latex-extra python3.11 python3-pip && pip3 install --break-system-packages awslambdaric. In the main file, among other things, I call event.get("queryStringParameters", event)["key"].

    If I call c from the "Test" tab in the AWS console, the function succeeds as expected; however, if I call it from the function URL in my browser (ie, .../?key=123&...), I get an "Internal Server Error" message. Looking at Cloudwatch tells me that the error is with the ...["key"] call, as it results in a KeyError.

    I can not replicate this with another Lambda that uses the default AWS Python base image (ie, a code editor window appears in the "Image" tab).

    Why does this only happen with non-Amazon images?

    Continue reading...

Compartilhe esta Página