Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions test-lambda-container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ FROM public.ecr.aws/lambda/python:3.11
# Add Sentry Layer
COPY --from=public.ecr.aws/sentry/sentry-python-serverless-sdk:6 /opt/ /opt

# Copy requirements.txt
COPY requirements.txt ${LAMBDA_TASK_ROOT}
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Copy project files
COPY pyproject.toml ${LAMBDA_TASK_ROOT}

# Copy function code
COPY lambda_function.py ${LAMBDA_TASK_ROOT}

# Install the specified packages
RUN pip install -r requirements.txt
RUN uv pip install --system --no-cache -r pyproject.toml

ENV SENTRY_INITIAL_HANDLER="lambda_function.handler"
ENV SENTRY_DSN="https://d655584d05f14c58b86e9034aab6817f@o447951.ingest.sentry.io/5461230"
ENV SENTRY_TRACES_SAMPLE_RATE="1.0"

# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
#CMD [ "lambda_function.handler" ]

CMD ["sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler"]

12 changes: 12 additions & 0 deletions test-lambda-container/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[project]
name = "test-lambda-container"
version = "0"
requires-python = ">=3.11"

dependencies = [
"boto3>=1.38.0",
"sentry-sdk",
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pip sentry-sdk duplicates Lambda layer

Medium Severity

The removed requirements.txt only listed boto3; Sentry for this container test came from the copied serverless layer under /opt/python. The new dependencies list adds sentry-sdk, so uv pip install pulls a second SDK into system site-packages while the image still ships the layer and uses the layer’s sentry_lambda_handler entrypoint, changing which SDK the smoke test exercises.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bac03ac. Configure here.


[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local sentry path breaks Docker build

High Severity

The pyproject.toml defines sentry-sdk as an editable path dependency (../../sentry-python). This path is outside the Docker build context and the source isn't copied into the container, causing uv pip install to fail during the image build.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bac03ac. Configure here.

Comment on lines +11 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The pyproject.toml references a local path dependency that is outside the Docker build context, which will either break the build or cause the wrong package version to be tested.
Severity: HIGH

Suggested Fix

Adjust the Docker build process to include the sentry-python source code. This can be achieved by changing the build context to a higher-level directory and adding a COPY instruction in the Dockerfile to bring the ../../sentry-python directory into the container image, allowing the local path dependency to resolve correctly.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: test-lambda-container/pyproject.toml#L11-L12

Potential issue: The `pyproject.toml` file defines `sentry-sdk` as a local editable
dependency with a path (`../../sentry-python`) that is outside the Docker build context
(`test-lambda-container/`). During the Docker build, this path is inaccessible. This
will either cause the build to fail when `uv pip install` cannot find the local
directory, or it may cause `uv` to silently install a public version of `sentry-sdk`
from PyPI. The latter would mean the test container is not testing the local development
code, defeating its primary purpose.

Did we get this right? 👍 / 👎 to inform future reviews.

1 change: 0 additions & 1 deletion test-lambda-container/requirements.txt

This file was deleted.

Loading