From 7ec8b1d30c0b275365ecf77e5681cfef3bcabc93 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 6 Jun 2023 08:44:44 +0200
Subject: [PATCH 01/62] Loading secrects into env

---
 .github/workflows/test-common.yml                            | 5 +++++
 .github/workflows/test-integration-aiohttp.yml               | 5 +++++
 .github/workflows/test-integration-arq.yml                   | 5 +++++
 .github/workflows/test-integration-asgi.yml                  | 5 +++++
 .github/workflows/test-integration-aws_lambda.yml            | 5 +++++
 .github/workflows/test-integration-beam.yml                  | 5 +++++
 .github/workflows/test-integration-boto3.yml                 | 5 +++++
 .github/workflows/test-integration-bottle.yml                | 5 +++++
 .github/workflows/test-integration-celery.yml                | 5 +++++
 .github/workflows/test-integration-chalice.yml               | 5 +++++
 .../workflows/test-integration-cloud_resource_context.yml    | 5 +++++
 .github/workflows/test-integration-django.yml                | 5 +++++
 .github/workflows/test-integration-falcon.yml                | 5 +++++
 .github/workflows/test-integration-fastapi.yml               | 5 +++++
 .github/workflows/test-integration-flask.yml                 | 5 +++++
 .github/workflows/test-integration-gcp.yml                   | 5 +++++
 .github/workflows/test-integration-gevent.yml                | 5 +++++
 .github/workflows/test-integration-grpc.yml                  | 5 +++++
 .github/workflows/test-integration-httpx.yml                 | 5 +++++
 .github/workflows/test-integration-huey.yml                  | 5 +++++
 .github/workflows/test-integration-loguru.yml                | 5 +++++
 .github/workflows/test-integration-opentelemetry.yml         | 5 +++++
 .github/workflows/test-integration-pure_eval.yml             | 5 +++++
 .github/workflows/test-integration-pymongo.yml               | 5 +++++
 .github/workflows/test-integration-pyramid.yml               | 5 +++++
 .github/workflows/test-integration-quart.yml                 | 5 +++++
 .github/workflows/test-integration-redis.yml                 | 5 +++++
 .github/workflows/test-integration-rediscluster.yml          | 5 +++++
 .github/workflows/test-integration-requests.yml              | 5 +++++
 .github/workflows/test-integration-rq.yml                    | 5 +++++
 .github/workflows/test-integration-sanic.yml                 | 5 +++++
 .github/workflows/test-integration-sqlalchemy.yml            | 5 +++++
 .github/workflows/test-integration-starlette.yml             | 5 +++++
 .github/workflows/test-integration-starlite.yml              | 5 +++++
 .github/workflows/test-integration-tornado.yml               | 5 +++++
 .github/workflows/test-integration-trytond.yml               | 5 +++++
 scripts/split-tox-gh-actions/ci-yaml.txt                     | 5 +++++
 37 files changed, 185 insertions(+)

diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml
index 46aec35dd4..086c76ff27 100644
--- a/.github/workflows/test-common.yml
+++ b/.github/workflows/test-common.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml
index 3db0a7b142..1e834c44dd 100644
--- a/.github/workflows/test-integration-aiohttp.yml
+++ b/.github/workflows/test-integration-aiohttp.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml
index 5b5ecc3a41..9d9c7231e0 100644
--- a/.github/workflows/test-integration-arq.yml
+++ b/.github/workflows/test-integration-arq.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-arq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml
index 4e0e676151..948d5cff3b 100644
--- a/.github/workflows/test-integration-asgi.yml
+++ b/.github/workflows/test-integration-asgi.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index c9bc60409e..f49a7a02af 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml
index a87524fb06..f2e9bb24c2 100644
--- a/.github/workflows/test-integration-beam.yml
+++ b/.github/workflows/test-integration-beam.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml
index 0c6cd55e9e..3b56f4b669 100644
--- a/.github/workflows/test-integration-boto3.yml
+++ b/.github/workflows/test-integration-boto3.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml
index b8c7561a2d..ed4d4f60df 100644
--- a/.github/workflows/test-integration-bottle.yml
+++ b/.github/workflows/test-integration-bottle.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml
index 21a4747d83..aa59a3144d 100644
--- a/.github/workflows/test-integration-celery.yml
+++ b/.github/workflows/test-integration-celery.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml
index 024193b64c..48405d5a49 100644
--- a/.github/workflows/test-integration-chalice.yml
+++ b/.github/workflows/test-integration-chalice.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml
index 95a3855b63..4f460a65df 100644
--- a/.github/workflows/test-integration-cloud_resource_context.yml
+++ b/.github/workflows/test-integration-cloud_resource_context.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-cloud_resource_context" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml
index dbd032d6dc..edef519dee 100644
--- a/.github/workflows/test-integration-django.yml
+++ b/.github/workflows/test-integration-django.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -78,6 +81,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml
index edabecbe11..f9d21ba85a 100644
--- a/.github/workflows/test-integration-falcon.yml
+++ b/.github/workflows/test-integration-falcon.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml
index a7325c21de..080316be6b 100644
--- a/.github/workflows/test-integration-fastapi.yml
+++ b/.github/workflows/test-integration-fastapi.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml
index 373e86c10d..beaa0a8c2b 100644
--- a/.github/workflows/test-integration-flask.yml
+++ b/.github/workflows/test-integration-flask.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml
index defd0e9b7d..fabe37a0ef 100644
--- a/.github/workflows/test-integration-gcp.yml
+++ b/.github/workflows/test-integration-gcp.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml
index 40acbce266..4598a5437d 100644
--- a/.github/workflows/test-integration-gevent.yml
+++ b/.github/workflows/test-integration-gevent.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml
index 4680eca69b..62b366fe85 100644
--- a/.github/workflows/test-integration-grpc.yml
+++ b/.github/workflows/test-integration-grpc.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-grpc" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml
index 0e487aac0e..8ffa5da671 100644
--- a/.github/workflows/test-integration-httpx.yml
+++ b/.github/workflows/test-integration-httpx.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml
index 22fda63543..6005a8bc63 100644
--- a/.github/workflows/test-integration-huey.yml
+++ b/.github/workflows/test-integration-huey.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml
index 98843f9867..eb7f75a589 100644
--- a/.github/workflows/test-integration-loguru.yml
+++ b/.github/workflows/test-integration-loguru.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-loguru" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml
index 903ea9a249..86f1914de0 100644
--- a/.github/workflows/test-integration-opentelemetry.yml
+++ b/.github/workflows/test-integration-opentelemetry.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-opentelemetry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml
index 7c75fc6e62..e201554a9b 100644
--- a/.github/workflows/test-integration-pure_eval.yml
+++ b/.github/workflows/test-integration-pure_eval.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pure_eval" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml
index d5b2743a67..e846218b62 100644
--- a/.github/workflows/test-integration-pymongo.yml
+++ b/.github/workflows/test-integration-pymongo.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml
index bb57639c9c..3210314e8f 100644
--- a/.github/workflows/test-integration-pyramid.yml
+++ b/.github/workflows/test-integration-pyramid.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml
index 798749e76e..369f3ed4eb 100644
--- a/.github/workflows/test-integration-quart.yml
+++ b/.github/workflows/test-integration-quart.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml
index 79998aaf6b..277e2fcc44 100644
--- a/.github/workflows/test-integration-redis.yml
+++ b/.github/workflows/test-integration-redis.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml
index 94fe58b12a..6c09b0cacf 100644
--- a/.github/workflows/test-integration-rediscluster.yml
+++ b/.github/workflows/test-integration-rediscluster.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml
index 321813d08e..97f958fd5b 100644
--- a/.github/workflows/test-integration-requests.yml
+++ b/.github/workflows/test-integration-requests.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml
index f12a9ed067..6e76516692 100644
--- a/.github/workflows/test-integration-rq.yml
+++ b/.github/workflows/test-integration-rq.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml
index fc0984e2e5..b06017b9b1 100644
--- a/.github/workflows/test-integration-sanic.yml
+++ b/.github/workflows/test-integration-sanic.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml
index 7208e67abd..1194349942 100644
--- a/.github/workflows/test-integration-sqlalchemy.yml
+++ b/.github/workflows/test-integration-sqlalchemy.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml
index 1d0b3879bc..615db7c371 100644
--- a/.github/workflows/test-integration-starlette.yml
+++ b/.github/workflows/test-integration-starlette.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml
index 6c74cbe4f0..fda873af0b 100644
--- a/.github/workflows/test-integration-starlite.yml
+++ b/.github/workflows/test-integration-starlite.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlite" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml
index 69bee7ff17..ed38a9992e 100644
--- a/.github/workflows/test-integration-tornado.yml
+++ b/.github/workflows/test-integration-tornado.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml
index 44fd273144..c590c6fc37 100644
--- a/.github/workflows/test-integration-trytond.yml
+++ b/.github/workflows/test-integration-trytond.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-trytond" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/scripts/split-tox-gh-actions/ci-yaml.txt b/scripts/split-tox-gh-actions/ci-yaml.txt
index a30afff42f..5385e6100e 100644
--- a/scripts/split-tox-gh-actions/ci-yaml.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml.txt
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -52,6 +55,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i

From 55c0861966159497db5c9661e8ad1d957e12c317 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 16 Oct 2023 16:45:08 +0200
Subject: [PATCH 02/62] something

---
 scripts/split-tox-gh-actions/ci-yaml.txt | 40 ++----------------------
 1 file changed, 2 insertions(+), 38 deletions(-)

diff --git a/scripts/split-tox-gh-actions/ci-yaml.txt b/scripts/split-tox-gh-actions/ci-yaml.txt
index 5385e6100e..7fde361b8d 100644
--- a/scripts/split-tox-gh-actions/ci-yaml.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml.txt
@@ -26,45 +26,9 @@ env:
     ${{ github.workspace }}/dist-serverless
 
 jobs:
-  test:
-    name: {{ framework }}, python ${{ matrix.python-version }}, ${{ matrix.os }}
-    runs-on: ${{ matrix.os }}
-    timeout-minutes: 30
-{{ strategy_matrix }}
-{{ services }}
+{{ test }}
 
-    steps:
-      - uses: actions/checkout@v3
-      - uses: actions/setup-python@v4
-        with:
-          python-version: ${{ matrix.python-version }}
-
-      - name: Setup Test Env
-        run: |
-          pip install coverage "tox>=3,<4"
-
-      - name: Test {{ framework }}
-        uses: nick-fields/retry@v2
-        with:
-          timeout_minutes: 15
-          max_attempts: 2
-          retry_wait_seconds: 5
-          shell: bash
-          command: |
-            set -x # print commands that are executed
-            coverage erase
-
-            # Run tests
-            echo "##############################"
-            printenv | sort
-            ./scripts/runtox.sh "py${{ matrix.python-version }}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
-            coverage combine .coverage* &&
-            coverage xml -i
-
-      - uses: codecov/codecov-action@v3
-        with:
-          token: ${{ secrets.CODECOV_TOKEN }}
-          files: coverage.xml
+{{ test_py27 }}
 
   check_required_tests:
     name: All {{ framework }} tests passed or skipped

From 2d596b78303dc4b59f27cb8b8eb2cc0494a5cd0e Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 16 Oct 2023 16:46:51 +0200
Subject: [PATCH 03/62] Updated test snippets

---
 .github/workflows/test-integration-ariadne.yml           | 5 +++++
 .github/workflows/test-integration-asyncpg.yml           | 5 +++++
 .github/workflows/test-integration-clickhouse_driver.yml | 5 +++++
 .github/workflows/test-integration-gql.yml               | 5 +++++
 .github/workflows/test-integration-graphene.yml          | 5 +++++
 .github/workflows/test-integration-strawberry.yml        | 5 +++++
 scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt    | 2 ++
 7 files changed, 32 insertions(+)

diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml
index eeb7a0208f..f670fb129e 100644
--- a/.github/workflows/test-integration-ariadne.yml
+++ b/.github/workflows/test-integration-ariadne.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-ariadne" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml
index de6ad8c9c0..ccc2d86c62 100644
--- a/.github/workflows/test-integration-asyncpg.yml
+++ b/.github/workflows/test-integration-asyncpg.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -81,6 +84,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asyncpg" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml
index 49b26e1803..431fa467b2 100644
--- a/.github/workflows/test-integration-clickhouse_driver.yml
+++ b/.github/workflows/test-integration-clickhouse_driver.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -62,6 +65,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-clickhouse_driver" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml
index 9ebd5a16b7..2d88101cfc 100644
--- a/.github/workflows/test-integration-gql.yml
+++ b/.github/workflows/test-integration-gql.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gql" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml
index 69d89958c3..10583f578e 100644
--- a/.github/workflows/test-integration-graphene.yml
+++ b/.github/workflows/test-integration-graphene.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-graphene" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml
index b0e30a8f5b..751cfa6c47 100644
--- a/.github/workflows/test-integration-strawberry.yml
+++ b/.github/workflows/test-integration-strawberry.yml
@@ -18,6 +18,9 @@ permissions:
   contents: read
 
 env:
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -60,6 +63,8 @@ jobs:
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
index c2d10596ea..d334b483af 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
@@ -29,6 +29,8 @@
             coverage erase
 
             # Run tests
+            echo "##############################"
+            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i

From a6408d7766913005bf7b0d8cd4f917a1c8389a5c Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 18 Oct 2023 13:33:27 +0200
Subject: [PATCH 04/62] Give lambda function a bit time to be created

---
 tests/integrations/aws_lambda/client.py   | 25 +++++++++++++++++------
 tests/integrations/aws_lambda/test_aws.py |  6 ++++--
 tox.ini                                   |  6 ++++--
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index d8e430f3d7..2ea51e9354 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -2,11 +2,14 @@
 import os
 import shutil
 import tempfile
+import time
 import subprocess
 import boto3
 import uuid
 import base64
 
+MAX_RETRIES = 10
+
 
 def get_boto_client():
     return boto3.client(
@@ -134,6 +137,7 @@ def run_lambda_function(
                     Code={"ZipFile": zip.read()},
                     Description="Created as part of testsuite for getsentry/sentry-python",
                 )
+
         else:
             subprocess.run(
                 ["zip", "-q", "-x", "**/__pycache__/*", "-r", "ball.zip", "./"],
@@ -163,12 +167,21 @@ def clean_up():
             for manager in managers:
                 manager.clear()
 
-        response = client.invoke(
-            FunctionName=fn_name,
-            InvocationType="RequestResponse",
-            LogType="Tail",
-            Payload=payload,
-        )
+        response = None
+        num_retries = 0
+
+        # It takes some time for the Lambda function to be created, so we retry
+        while response is None and num_retries < MAX_RETRIES:
+            try:
+                response = client.invoke(
+                    FunctionName=fn_name,
+                    InvocationType="RequestResponse",
+                    LogType="Tail",
+                    Payload=payload,
+                )
+                time.sleep(0.2)
+            except client.exceptions.ResourceConflictException:
+                num_retries += 1
 
         assert 200 <= response["StatusCode"] < 300, response
         return response
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 5825e5fca9..e4393bbd71 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -104,9 +104,11 @@ def lambda_client():
 
 @pytest.fixture(
     params=[
-        "python3.7",
-        "python3.8",
+        # "python3.7",
+        # "python3.8",
         "python3.9",
+        # "python3.10",
+        # "python3.11",
     ]
 )
 def lambda_runtime(request):
diff --git a/tox.ini b/tox.ini
index 2f082b8d58..bf72e22c6e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -35,8 +35,10 @@ envlist =
     {py3.7,py3.8,py3.9,py3.10,py3.11}-asyncpg
 
     # AWS Lambda
-    # The aws_lambda tests deploy to the real AWS and have their own matrix of Python versions.
-    {py3.7}-aws_lambda
+    # The aws_lambda tests deploy to the real AWS and have their own
+    # matrix of Python versions to run the test lambda function in.
+    # see `lambda_runtime` fixture in tests/integrations/aws_lambda.py
+    {py3.9}-aws_lambda
 
     # Beam
     {py3.7}-beam-v{2.12,2.13,2.32,2.33}

From f6510645176c8040a36ae92b4c07ebdb1417a4e7 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 18 Oct 2023 15:35:59 +0200
Subject: [PATCH 05/62] Fixed lambda log output

---
 tests/integrations/aws_lambda/test_aws.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index e4393bbd71..84fe9ad63d 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -70,16 +70,17 @@ def envelope_processor(envelope):
 class TestTransport(HttpTransport):
     def _send_event(self, event):
         event = event_processor(event)
-        # Writing a single string to stdout holds the GIL (seems like) and
-        # therefore cannot be interleaved with other threads. This is why we
-        # explicitly add a newline at the end even though `print` would provide
-        # us one.
-        print("\\nEVENT: {}\\n".format(json.dumps(event)))
+        # we need to print something (blank or newline does not work)
+        # for Lambda to add a new line to the log output
+        print(".")
+        print("EVENT: {}".format(json.dumps(event)))
 
     def _send_envelope(self, envelope):
         envelope = envelope_processor(envelope)
-        print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
-
+        # we need to print something (blank or newline does not work)
+        # for Lambda to add a new line to the log output
+        print(".")
+        print("ENVELOPE: {}".format(json.dumps(envelope)))
 
 def init_sdk(timeout_warning=False, **extra_init_args):
     sentry_sdk.init(
@@ -104,11 +105,9 @@ def lambda_client():
 
 @pytest.fixture(
     params=[
-        # "python3.7",
-        # "python3.8",
         "python3.9",
-        # "python3.10",
-        # "python3.11",
+        "python3.10",
+        "python3.11",
     ]
 )
 def lambda_runtime(request):

From 0f2ca8c685b04a7f69e6cb77ddddad0cd8d0d5ce Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 18 Oct 2023 15:42:30 +0200
Subject: [PATCH 06/62] Updated test matrix

---
 .github/workflows/test-integration-aws_lambda.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index 845f6d4891..7edba1437b 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -34,7 +34,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ["3.7"]
+        python-version: ["3.9"]
         # python3.6 reached EOL and is no longer being supported on
         # new versions of hosted runners on Github Actions
         # ubuntu-20.04 is the last version that supported python3.6

From 4dee76445e1c0e93a214571de912728201d7450b Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 18 Oct 2023 15:52:02 +0200
Subject: [PATCH 07/62] Updated helper script

---
 scripts/aws-deploy-local-layer.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/aws-deploy-local-layer.sh b/scripts/aws-deploy-local-layer.sh
index 3f213849f3..57dcba6b55 100755
--- a/scripts/aws-deploy-local-layer.sh
+++ b/scripts/aws-deploy-local-layer.sh
@@ -22,7 +22,7 @@ aws lambda publish-layer-version \
     --region "eu-central-1" \
     --zip-file "fileb://dist/$ZIP" \
     --description "Local test build of SentryPythonServerlessSDK (can be deleted)" \
-    --compatible-runtimes python3.6 python3.7 python3.8 python3.9
+    --compatible-runtimes python3.8 python3.9 python3.10 python3.11 \
     --no-cli-pager
 
 echo "Done deploying zipped Lambda layer to AWS as 'SentryPythonServerlessSDK-local-dev'."

From b8d021e5bad2742ce8fe05c66af0c3b4300c7f44 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 18 Oct 2023 17:39:55 +0200
Subject: [PATCH 08/62] More retries and better error message in case of
 failure

---
 tests/integrations/aws_lambda/client.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 2ea51e9354..bb03a01e15 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -8,7 +8,7 @@
 import uuid
 import base64
 
-MAX_RETRIES = 10
+MAX_RETRIES = 20
 
 
 def get_boto_client():
@@ -183,6 +183,9 @@ def clean_up():
             except client.exceptions.ResourceConflictException:
                 num_retries += 1
 
+        assert (
+            response is not None
+        ), "Failed to create Lambda function in time (max retries exceeded)"
         assert 200 <= response["StatusCode"] < 300, response
         return response
 

From 24351ca0178cbd3228701902b28c36fa95831a99 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 18 Oct 2023 17:41:23 +0200
Subject: [PATCH 09/62] Cleanup

---
 .github/workflows/test-common.yml                             | 2 --
 .github/workflows/test-integration-aiohttp.yml                | 2 --
 .github/workflows/test-integration-ariadne.yml                | 2 --
 .github/workflows/test-integration-arq.yml                    | 2 --
 .github/workflows/test-integration-asgi.yml                   | 2 --
 .github/workflows/test-integration-asyncpg.yml                | 2 --
 .github/workflows/test-integration-aws_lambda.yml             | 2 --
 .github/workflows/test-integration-beam.yml                   | 2 --
 .github/workflows/test-integration-boto3.yml                  | 2 --
 .github/workflows/test-integration-bottle.yml                 | 2 --
 .github/workflows/test-integration-celery.yml                 | 2 --
 .github/workflows/test-integration-chalice.yml                | 2 --
 .github/workflows/test-integration-clickhouse_driver.yml      | 2 --
 .github/workflows/test-integration-cloud_resource_context.yml | 2 --
 .github/workflows/test-integration-django.yml                 | 2 --
 .github/workflows/test-integration-falcon.yml                 | 2 --
 .github/workflows/test-integration-fastapi.yml                | 2 --
 .github/workflows/test-integration-flask.yml                  | 2 --
 .github/workflows/test-integration-gcp.yml                    | 2 --
 .github/workflows/test-integration-gevent.yml                 | 2 --
 .github/workflows/test-integration-gql.yml                    | 2 --
 .github/workflows/test-integration-graphene.yml               | 2 --
 .github/workflows/test-integration-grpc.yml                   | 2 --
 .github/workflows/test-integration-httpx.yml                  | 2 --
 .github/workflows/test-integration-huey.yml                   | 2 --
 .github/workflows/test-integration-loguru.yml                 | 2 --
 .github/workflows/test-integration-opentelemetry.yml          | 2 --
 .github/workflows/test-integration-pure_eval.yml              | 2 --
 .github/workflows/test-integration-pymongo.yml                | 2 --
 .github/workflows/test-integration-pyramid.yml                | 2 --
 .github/workflows/test-integration-quart.yml                  | 2 --
 .github/workflows/test-integration-redis.yml                  | 2 --
 .github/workflows/test-integration-rediscluster.yml           | 2 --
 .github/workflows/test-integration-requests.yml               | 2 --
 .github/workflows/test-integration-rq.yml                     | 2 --
 .github/workflows/test-integration-sanic.yml                  | 2 --
 .github/workflows/test-integration-sqlalchemy.yml             | 2 --
 .github/workflows/test-integration-starlette.yml              | 2 --
 .github/workflows/test-integration-starlite.yml               | 2 --
 .github/workflows/test-integration-strawberry.yml             | 2 --
 .github/workflows/test-integration-tornado.yml                | 2 --
 .github/workflows/test-integration-trytond.yml                | 2 --
 scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt         | 2 --
 43 files changed, 86 deletions(-)

diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml
index 6e11dd6bba..6bf1270007 100644
--- a/.github/workflows/test-common.yml
+++ b/.github/workflows/test-common.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml
index c4756e2045..181b151c28 100644
--- a/.github/workflows/test-integration-aiohttp.yml
+++ b/.github/workflows/test-integration-aiohttp.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml
index f670fb129e..9372a5f287 100644
--- a/.github/workflows/test-integration-ariadne.yml
+++ b/.github/workflows/test-integration-ariadne.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-ariadne" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml
index 3266f3dbab..85cf6ae9fa 100644
--- a/.github/workflows/test-integration-arq.yml
+++ b/.github/workflows/test-integration-arq.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-arq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml
index 9523c94e00..2ac24b8b8c 100644
--- a/.github/workflows/test-integration-asgi.yml
+++ b/.github/workflows/test-integration-asgi.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml
index ccc2d86c62..4d942ad6a0 100644
--- a/.github/workflows/test-integration-asyncpg.yml
+++ b/.github/workflows/test-integration-asyncpg.yml
@@ -84,8 +84,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asyncpg" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index 7edba1437b..8a3652b4df 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml
index 8e2ea0fd43..173662dcae 100644
--- a/.github/workflows/test-integration-beam.yml
+++ b/.github/workflows/test-integration-beam.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml
index 81b571f27a..9cee90f046 100644
--- a/.github/workflows/test-integration-boto3.yml
+++ b/.github/workflows/test-integration-boto3.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml
index 73d2a1c020..cbc86e5ef2 100644
--- a/.github/workflows/test-integration-bottle.yml
+++ b/.github/workflows/test-integration-bottle.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml
index b5fd20f8f1..fc36409ecb 100644
--- a/.github/workflows/test-integration-celery.yml
+++ b/.github/workflows/test-integration-celery.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml
index 16b3db27d0..d410f8858d 100644
--- a/.github/workflows/test-integration-chalice.yml
+++ b/.github/workflows/test-integration-chalice.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml
index 431fa467b2..4b05d00204 100644
--- a/.github/workflows/test-integration-clickhouse_driver.yml
+++ b/.github/workflows/test-integration-clickhouse_driver.yml
@@ -65,8 +65,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-clickhouse_driver" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml
index 6ea5006ff9..f37dc16749 100644
--- a/.github/workflows/test-integration-cloud_resource_context.yml
+++ b/.github/workflows/test-integration-cloud_resource_context.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-cloud_resource_context" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml
index e1a4e635ea..c6dfa188b9 100644
--- a/.github/workflows/test-integration-django.yml
+++ b/.github/workflows/test-integration-django.yml
@@ -84,8 +84,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml
index db06d57888..5e4f7d36f9 100644
--- a/.github/workflows/test-integration-falcon.yml
+++ b/.github/workflows/test-integration-falcon.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml
index deef4f4c11..24cd1f4933 100644
--- a/.github/workflows/test-integration-fastapi.yml
+++ b/.github/workflows/test-integration-fastapi.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml
index 2b25fec6a0..7258bd06bb 100644
--- a/.github/workflows/test-integration-flask.yml
+++ b/.github/workflows/test-integration-flask.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml
index 8b9f9bd3be..fd513a3d87 100644
--- a/.github/workflows/test-integration-gcp.yml
+++ b/.github/workflows/test-integration-gcp.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml
index ea70889ea6..5052394c49 100644
--- a/.github/workflows/test-integration-gevent.yml
+++ b/.github/workflows/test-integration-gevent.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml
index 2d88101cfc..df237d90a0 100644
--- a/.github/workflows/test-integration-gql.yml
+++ b/.github/workflows/test-integration-gql.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gql" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml
index 10583f578e..96d15609ee 100644
--- a/.github/workflows/test-integration-graphene.yml
+++ b/.github/workflows/test-integration-graphene.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-graphene" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml
index a2192d76a0..1ebe8e6b31 100644
--- a/.github/workflows/test-integration-grpc.yml
+++ b/.github/workflows/test-integration-grpc.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-grpc" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml
index aa6e4a50bb..32cd0142b3 100644
--- a/.github/workflows/test-integration-httpx.yml
+++ b/.github/workflows/test-integration-httpx.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml
index cdb8922812..dd9558d7ac 100644
--- a/.github/workflows/test-integration-huey.yml
+++ b/.github/workflows/test-integration-huey.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml
index e2f7fca5ed..57cfa68b2f 100644
--- a/.github/workflows/test-integration-loguru.yml
+++ b/.github/workflows/test-integration-loguru.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-loguru" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml
index c4bfcc904e..0eef5fc598 100644
--- a/.github/workflows/test-integration-opentelemetry.yml
+++ b/.github/workflows/test-integration-opentelemetry.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-opentelemetry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml
index ff76d6b213..74e6cb075a 100644
--- a/.github/workflows/test-integration-pure_eval.yml
+++ b/.github/workflows/test-integration-pure_eval.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pure_eval" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml
index a0a7b63eae..412e6f6f09 100644
--- a/.github/workflows/test-integration-pymongo.yml
+++ b/.github/workflows/test-integration-pymongo.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml
index 76cd6c1dbe..e095217290 100644
--- a/.github/workflows/test-integration-pyramid.yml
+++ b/.github/workflows/test-integration-pyramid.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml
index 12a3856307..48209a1e54 100644
--- a/.github/workflows/test-integration-quart.yml
+++ b/.github/workflows/test-integration-quart.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml
index 6999e1266b..e7b89c09f6 100644
--- a/.github/workflows/test-integration-redis.yml
+++ b/.github/workflows/test-integration-redis.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml
index a7e58f3319..11d7f366a9 100644
--- a/.github/workflows/test-integration-rediscluster.yml
+++ b/.github/workflows/test-integration-rediscluster.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml
index 4e4c7f8b5d..65b0ef259a 100644
--- a/.github/workflows/test-integration-requests.yml
+++ b/.github/workflows/test-integration-requests.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml
index 3ad254a374..c4bca56242 100644
--- a/.github/workflows/test-integration-rq.yml
+++ b/.github/workflows/test-integration-rq.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml
index 9ddb5aa381..fae3aa0993 100644
--- a/.github/workflows/test-integration-sanic.yml
+++ b/.github/workflows/test-integration-sanic.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml
index 61aecfba5b..3dd3bb6cae 100644
--- a/.github/workflows/test-integration-sqlalchemy.yml
+++ b/.github/workflows/test-integration-sqlalchemy.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml
index 1bb47cfbc2..5b5fc63c18 100644
--- a/.github/workflows/test-integration-starlette.yml
+++ b/.github/workflows/test-integration-starlette.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml
index 9d8989972d..b81782d592 100644
--- a/.github/workflows/test-integration-starlite.yml
+++ b/.github/workflows/test-integration-starlite.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlite" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml
index 751cfa6c47..e54f3325e8 100644
--- a/.github/workflows/test-integration-strawberry.yml
+++ b/.github/workflows/test-integration-strawberry.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml
index a649dbf4dc..38351c932a 100644
--- a/.github/workflows/test-integration-tornado.yml
+++ b/.github/workflows/test-integration-tornado.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml
index 331e369bcc..4c3c47ce39 100644
--- a/.github/workflows/test-integration-trytond.yml
+++ b/.github/workflows/test-integration-trytond.yml
@@ -63,8 +63,6 @@ jobs:
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-trytond" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i
diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
index d334b483af..c2d10596ea 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
@@ -29,8 +29,6 @@
             coverage erase
 
             # Run tests
-            echo "##############################"
-            printenv | sort
             ./scripts/runtox.sh "py${{ matrix.python-version }}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
             coverage xml -i

From a1ab4b6ecc18e484b364d15ada64e8c835f2b167 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 18 Oct 2023 17:52:39 +0200
Subject: [PATCH 10/62] Maybe it works in CI that way

---
 tests/integrations/aws_lambda/test_aws.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 84fe9ad63d..6f67d565f4 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -70,17 +70,11 @@ def envelope_processor(envelope):
 class TestTransport(HttpTransport):
     def _send_event(self, event):
         event = event_processor(event)
-        # we need to print something (blank or newline does not work)
-        # for Lambda to add a new line to the log output
-        print(".")
-        print("EVENT: {}".format(json.dumps(event)))
+        print("\\nEVENT: {}\\n".format(json.dumps(event)))
 
     def _send_envelope(self, envelope):
         envelope = envelope_processor(envelope)
-        # we need to print something (blank or newline does not work)
-        # for Lambda to add a new line to the log output
-        print(".")
-        print("ENVELOPE: {}".format(json.dumps(envelope)))
+        print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
 
 def init_sdk(timeout_warning=False, **extra_init_args):
     sentry_sdk.init(

From a67c40a19fd0331d36717aa0219689d35f53b9fe Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 09:55:10 +0200
Subject: [PATCH 11/62] Running tests in localstack instead of actual AWS

---
 .github/workflows/test-common.yml             |  3 -
 .../workflows/test-integration-aiohttp.yml    |  3 -
 .../workflows/test-integration-ariadne.yml    |  3 -
 .github/workflows/test-integration-arq.yml    |  3 -
 .github/workflows/test-integration-asgi.yml   |  3 -
 .../workflows/test-integration-asyncpg.yml    |  3 -
 .../workflows/test-integration-aws_lambda.yml |  9 ++-
 .github/workflows/test-integration-beam.yml   |  3 -
 .github/workflows/test-integration-boto3.yml  |  3 -
 .github/workflows/test-integration-bottle.yml |  3 -
 .github/workflows/test-integration-celery.yml |  3 -
 .../workflows/test-integration-chalice.yml    |  3 -
 .../test-integration-clickhouse_driver.yml    |  3 -
 ...est-integration-cloud_resource_context.yml |  3 -
 .github/workflows/test-integration-django.yml |  3 -
 .github/workflows/test-integration-falcon.yml |  3 -
 .../workflows/test-integration-fastapi.yml    |  3 -
 .github/workflows/test-integration-flask.yml  |  3 -
 .github/workflows/test-integration-gcp.yml    |  3 -
 .github/workflows/test-integration-gevent.yml |  3 -
 .github/workflows/test-integration-gql.yml    |  3 -
 .../workflows/test-integration-graphene.yml   |  3 -
 .github/workflows/test-integration-grpc.yml   |  3 -
 .github/workflows/test-integration-httpx.yml  |  3 -
 .github/workflows/test-integration-huey.yml   |  3 -
 .github/workflows/test-integration-loguru.yml |  3 -
 .../test-integration-opentelemetry.yml        |  3 -
 .../workflows/test-integration-pure_eval.yml  |  3 -
 .../workflows/test-integration-pymongo.yml    |  3 -
 .../workflows/test-integration-pyramid.yml    |  3 -
 .github/workflows/test-integration-quart.yml  |  3 -
 .github/workflows/test-integration-redis.yml  |  3 -
 .../test-integration-rediscluster.yml         |  3 -
 .../workflows/test-integration-requests.yml   |  3 -
 .github/workflows/test-integration-rq.yml     |  3 -
 .github/workflows/test-integration-sanic.yml  |  3 -
 .../workflows/test-integration-sqlalchemy.yml |  3 -
 .../workflows/test-integration-starlette.yml  |  3 -
 .../workflows/test-integration-starlite.yml   |  3 -
 .../workflows/test-integration-strawberry.yml |  3 -
 .../workflows/test-integration-tornado.yml    |  3 -
 .../workflows/test-integration-trytond.yml    |  3 -
 scripts/aws-cleanup.sh                        |  0
 .../ci-yaml-test-snippet.txt                  |  1 +
 scripts/split-tox-gh-actions/ci-yaml.txt      |  3 -
 .../split-tox-gh-actions.py                   | 10 +++
 tests/integrations/aws_lambda/client.py       | 74 +++++++++++++------
 tests/integrations/aws_lambda/test_aws.py     | 20 +++--
 tox.ini                                       |  3 -
 49 files changed, 79 insertions(+), 164 deletions(-)
 mode change 100644 => 100755 scripts/aws-cleanup.sh

diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml
index 6bf1270007..03117b7db1 100644
--- a/.github/workflows/test-common.yml
+++ b/.github/workflows/test-common.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml
index 181b151c28..f70d652f2e 100644
--- a/.github/workflows/test-integration-aiohttp.yml
+++ b/.github/workflows/test-integration-aiohttp.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml
index 9372a5f287..eeb7a0208f 100644
--- a/.github/workflows/test-integration-ariadne.yml
+++ b/.github/workflows/test-integration-ariadne.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml
index 85cf6ae9fa..9a902ab20c 100644
--- a/.github/workflows/test-integration-arq.yml
+++ b/.github/workflows/test-integration-arq.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml
index 2ac24b8b8c..1b9e6916ec 100644
--- a/.github/workflows/test-integration-asgi.yml
+++ b/.github/workflows/test-integration-asgi.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml
index 4d942ad6a0..de6ad8c9c0 100644
--- a/.github/workflows/test-integration-asyncpg.yml
+++ b/.github/workflows/test-integration-asyncpg.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index 8a3652b4df..d2f8d199be 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
@@ -50,7 +47,13 @@ jobs:
       - name: Setup Test Env
         run: |
           pip install coverage "tox>=3,<4"
+          pip install localstack                    # install LocalStack cli
+          docker pull localstack/localstack         # Make sure to pull the latest version of the image
+          localstack start -d                       # Start LocalStack in the background
 
+          echo "Waiting for LocalStack startup..."  # Wait 30 seconds for the LocalStack container
+          localstack wait -t 30                     # to become ready before timing out
+          echo "Startup complete"
       - name: Test aws_lambda
         uses: nick-fields/retry@v2
         with:
diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml
index 173662dcae..a86d6ccd7d 100644
--- a/.github/workflows/test-integration-beam.yml
+++ b/.github/workflows/test-integration-beam.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml
index 9cee90f046..fb246c899e 100644
--- a/.github/workflows/test-integration-boto3.yml
+++ b/.github/workflows/test-integration-boto3.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml
index cbc86e5ef2..41e496a12b 100644
--- a/.github/workflows/test-integration-bottle.yml
+++ b/.github/workflows/test-integration-bottle.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml
index fc36409ecb..71623f0e1e 100644
--- a/.github/workflows/test-integration-celery.yml
+++ b/.github/workflows/test-integration-celery.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml
index d410f8858d..6615aeb75d 100644
--- a/.github/workflows/test-integration-chalice.yml
+++ b/.github/workflows/test-integration-chalice.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml
index 4b05d00204..49b26e1803 100644
--- a/.github/workflows/test-integration-clickhouse_driver.yml
+++ b/.github/workflows/test-integration-clickhouse_driver.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml
index f37dc16749..c59dca3078 100644
--- a/.github/workflows/test-integration-cloud_resource_context.yml
+++ b/.github/workflows/test-integration-cloud_resource_context.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml
index c6dfa188b9..d667464212 100644
--- a/.github/workflows/test-integration-django.yml
+++ b/.github/workflows/test-integration-django.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml
index 5e4f7d36f9..522956c959 100644
--- a/.github/workflows/test-integration-falcon.yml
+++ b/.github/workflows/test-integration-falcon.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml
index 24cd1f4933..87af0054c7 100644
--- a/.github/workflows/test-integration-fastapi.yml
+++ b/.github/workflows/test-integration-fastapi.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml
index 7258bd06bb..301256dffc 100644
--- a/.github/workflows/test-integration-flask.yml
+++ b/.github/workflows/test-integration-flask.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml
index fd513a3d87..c6eb4adcc8 100644
--- a/.github/workflows/test-integration-gcp.yml
+++ b/.github/workflows/test-integration-gcp.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml
index 5052394c49..d879f5c2f5 100644
--- a/.github/workflows/test-integration-gevent.yml
+++ b/.github/workflows/test-integration-gevent.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml
index df237d90a0..9ebd5a16b7 100644
--- a/.github/workflows/test-integration-gql.yml
+++ b/.github/workflows/test-integration-gql.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml
index 96d15609ee..69d89958c3 100644
--- a/.github/workflows/test-integration-graphene.yml
+++ b/.github/workflows/test-integration-graphene.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml
index 1ebe8e6b31..8c79fae4b8 100644
--- a/.github/workflows/test-integration-grpc.yml
+++ b/.github/workflows/test-integration-grpc.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml
index 32cd0142b3..8aadb01812 100644
--- a/.github/workflows/test-integration-httpx.yml
+++ b/.github/workflows/test-integration-httpx.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml
index dd9558d7ac..a335b9dc9c 100644
--- a/.github/workflows/test-integration-huey.yml
+++ b/.github/workflows/test-integration-huey.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml
index 57cfa68b2f..f2b6b50317 100644
--- a/.github/workflows/test-integration-loguru.yml
+++ b/.github/workflows/test-integration-loguru.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml
index 0eef5fc598..4179d2d22d 100644
--- a/.github/workflows/test-integration-opentelemetry.yml
+++ b/.github/workflows/test-integration-opentelemetry.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml
index 74e6cb075a..c723e02ede 100644
--- a/.github/workflows/test-integration-pure_eval.yml
+++ b/.github/workflows/test-integration-pure_eval.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml
index 412e6f6f09..ee7e21c425 100644
--- a/.github/workflows/test-integration-pymongo.yml
+++ b/.github/workflows/test-integration-pymongo.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml
index e095217290..6ad34e17d0 100644
--- a/.github/workflows/test-integration-pyramid.yml
+++ b/.github/workflows/test-integration-pyramid.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml
index 48209a1e54..4c6ccb3157 100644
--- a/.github/workflows/test-integration-quart.yml
+++ b/.github/workflows/test-integration-quart.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml
index e7b89c09f6..4af86fde47 100644
--- a/.github/workflows/test-integration-redis.yml
+++ b/.github/workflows/test-integration-redis.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml
index 11d7f366a9..73ed5c1733 100644
--- a/.github/workflows/test-integration-rediscluster.yml
+++ b/.github/workflows/test-integration-rediscluster.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml
index 65b0ef259a..2645b13305 100644
--- a/.github/workflows/test-integration-requests.yml
+++ b/.github/workflows/test-integration-requests.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml
index c4bca56242..6aec4ac632 100644
--- a/.github/workflows/test-integration-rq.yml
+++ b/.github/workflows/test-integration-rq.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml
index fae3aa0993..27ca05eb6a 100644
--- a/.github/workflows/test-integration-sanic.yml
+++ b/.github/workflows/test-integration-sanic.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml
index 3dd3bb6cae..a45ede7a2f 100644
--- a/.github/workflows/test-integration-sqlalchemy.yml
+++ b/.github/workflows/test-integration-sqlalchemy.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml
index 5b5fc63c18..e19578b95c 100644
--- a/.github/workflows/test-integration-starlette.yml
+++ b/.github/workflows/test-integration-starlette.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml
index b81782d592..01715e1c66 100644
--- a/.github/workflows/test-integration-starlite.yml
+++ b/.github/workflows/test-integration-starlite.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml
index e54f3325e8..b0e30a8f5b 100644
--- a/.github/workflows/test-integration-strawberry.yml
+++ b/.github/workflows/test-integration-strawberry.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml
index 38351c932a..ac4700db4a 100644
--- a/.github/workflows/test-integration-tornado.yml
+++ b/.github/workflows/test-integration-tornado.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml
index 4c3c47ce39..130ed096f7 100644
--- a/.github/workflows/test-integration-trytond.yml
+++ b/.github/workflows/test-integration-trytond.yml
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/scripts/aws-cleanup.sh b/scripts/aws-cleanup.sh
old mode 100644
new mode 100755
diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
index c2d10596ea..d998e74ab8 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
@@ -16,6 +16,7 @@
         run: |
           pip install coverage "tox>=3,<4"
           {{ setup_postgres }}
+          {{ setup_localstack }}
 
       - name: Test {{ framework }}
         uses: nick-fields/retry@v2
diff --git a/scripts/split-tox-gh-actions/ci-yaml.txt b/scripts/split-tox-gh-actions/ci-yaml.txt
index 9ab21cb585..99d8154c60 100644
--- a/scripts/split-tox-gh-actions/ci-yaml.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml.txt
@@ -18,9 +18,6 @@ permissions:
   contents: read
 
 env:
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
diff --git a/scripts/split-tox-gh-actions/split-tox-gh-actions.py b/scripts/split-tox-gh-actions/split-tox-gh-actions.py
index 15f85391ed..a9180e2beb 100755
--- a/scripts/split-tox-gh-actions/split-tox-gh-actions.py
+++ b/scripts/split-tox-gh-actions/split-tox-gh-actions.py
@@ -28,6 +28,7 @@
 TEMPLATE_FILE = TEMPLATE_DIR / "ci-yaml.txt"
 TEMPLATE_FILE_SERVICES = TEMPLATE_DIR / "ci-yaml-services.txt"
 TEMPLATE_FILE_SETUP_DB = TEMPLATE_DIR / "ci-yaml-setup-db.txt"
+TEMPLATE_FILE_SETUP_LOCALSTACK = TEMPLATE_DIR / "ci-yaml-setup-localstack.txt"
 TEMPLATE_SNIPPET_TEST = TEMPLATE_DIR / "ci-yaml-test-snippet.txt"
 TEMPLATE_SNIPPET_TEST_PY27 = TEMPLATE_DIR / "ci-yaml-test-py27-snippet.txt"
 
@@ -40,6 +41,10 @@
     "clickhouse_driver",
 ]
 
+FRAMEWORKS_NEEDING_AWS = [
+    "aws_lambda",
+]
+
 MATRIX_DEFINITION = """
     strategy:
       fail-fast: false
@@ -128,6 +133,11 @@ def write_yaml_file(
                 f = open(TEMPLATE_FILE_SETUP_DB, "r")
                 out += "".join(f.readlines())
 
+        elif template_line.strip() == "{{ setup_localstack }}":
+            if current_framework in FRAMEWORKS_NEEDING_AWS:
+                f = open(TEMPLATE_FILE_SETUP_LOCALSTACK, "r")
+                out += "".join(f.readlines())
+
         elif template_line.strip() == "{{ additional_uses }}":
             if current_framework in FRAMEWORKS_NEEDING_CLICKHOUSE:
                 out += ADDITIONAL_USES_CLICKHOUSE
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index bb03a01e15..50198108fb 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -2,21 +2,59 @@
 import os
 import shutil
 import tempfile
-import time
 import subprocess
 import boto3
 import uuid
 import base64
 
-MAX_RETRIES = 20
+
+AWS_ENDPOINT_LOCALSTACK = "http://localhost:4566"
+AWS_LAMBDA_EXECUTION_ROLE_ARN = None
+
+
+def get_or_create_lambda_execution_role():
+    global AWS_LAMBDA_EXECUTION_ROLE_ARN
+    role_name = "lambda-ex"
+    policy = """
+    {
+        "Version": "2012-10-17",
+        "Statement": [
+            {
+                "Effect": "Allow",
+                "Principal": {
+                    "Service": "lambda.amazonaws.com"
+                },
+                "Action": "sts:AssumeRole"
+            }
+        ]
+    }
+    """
+    iam_client = boto3.client("iam", endpoint_url=AWS_ENDPOINT_LOCALSTACK)
+
+    try:
+        response = iam_client.get_role(RoleName=role_name)
+        AWS_LAMBDA_EXECUTION_ROLE_ARN = response["Role"]["Arn"]
+    except iam_client.exceptions.NoSuchEntityException:
+        # create role for lambda execution
+        response = iam_client.create_role(
+            RoleName=role_name,
+            AssumeRolePolicyDocument=policy,
+        )
+        AWS_LAMBDA_EXECUTION_ROLE_ARN = response["Role"]["Arn"]
+
+        # attach policy to role
+        iam_client.attach_role_policy(
+            RoleName=role_name,
+            PolicyArn="arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
+        )
 
 
 def get_boto_client():
+    get_or_create_lambda_execution_role()
+
     return boto3.client(
         "lambda",
-        aws_access_key_id=os.environ["SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"],
-        aws_secret_access_key=os.environ["SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"],
-        region_name="us-east-1",
+        endpoint_url=AWS_ENDPOINT_LOCALSTACK,
     )
 
 
@@ -51,7 +89,7 @@ def build_no_code_serverless_function_and_layer(
                     "SENTRY_TRACES_SAMPLE_RATE": "1.0",
                 }
             },
-            Role=os.environ["SENTRY_PYTHON_TEST_AWS_IAM_ROLE"],
+            Role=AWS_LAMBDA_EXECUTION_ROLE_ARN,
             Handler="sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler",
             Layers=[response["LayerVersionArn"]],
             Code={"ZipFile": zip.read()},
@@ -132,7 +170,7 @@ def run_lambda_function(
                     FunctionName=fn_name,
                     Runtime=runtime,
                     Timeout=timeout,
-                    Role=os.environ["SENTRY_PYTHON_TEST_AWS_IAM_ROLE"],
+                    Role=AWS_LAMBDA_EXECUTION_ROLE_ARN,
                     Handler="test_lambda.test_handler",
                     Code={"ZipFile": zip.read()},
                     Description="Created as part of testsuite for getsentry/sentry-python",
@@ -167,21 +205,15 @@ def clean_up():
             for manager in managers:
                 manager.clear()
 
-        response = None
-        num_retries = 0
+        waiter = client.get_waiter("function_active_v2")
+        waiter.wait(FunctionName=fn_name)
 
-        # It takes some time for the Lambda function to be created, so we retry
-        while response is None and num_retries < MAX_RETRIES:
-            try:
-                response = client.invoke(
-                    FunctionName=fn_name,
-                    InvocationType="RequestResponse",
-                    LogType="Tail",
-                    Payload=payload,
-                )
-                time.sleep(0.2)
-            except client.exceptions.ResourceConflictException:
-                num_retries += 1
+        response = client.invoke(
+            FunctionName=fn_name,
+            InvocationType="RequestResponse",
+            LogType="Tail",
+            Payload=payload,
+        )
 
         assert (
             response is not None
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 6f67d565f4..d358e854ee 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -1,13 +1,16 @@
 """
 # AWS Lambda system tests
 
-This testsuite uses boto3 to upload actual lambda functions to AWS, execute
-them and assert some things about the externally observed behavior. What that
-means for you is that those tests won't run without AWS access keys:
+This testsuite uses boto3 to upload actual Lambda functions to a locally running
+localstack instance. (Localstack is a fully functional local AWS stack. See https://localstack.cloud/)
 
-    export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID=..
-    export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY=...
-    export SENTRY_PYTHON_TEST_AWS_IAM_ROLE="arn:aws:iam::920901907255:role/service-role/lambda"
+Run localstack on your machine:
+    docker run \
+        --rm -it \
+        -p 4566:4566 \
+        -p 4510-4559:4510-4559 \
+        -v "/var/run/docker.sock:/var/run/docker.sock" \
+        localstack/localstack
 
 If you need to debug a new runtime, use this REPL to figure things out:
 
@@ -16,13 +19,11 @@
 """
 import base64
 import json
-import os
 import re
 from textwrap import dedent
 
 import pytest
 
-
 LAMBDA_PRELUDE = """
 from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration, get_lambda_bootstrap
 import sentry_sdk
@@ -89,9 +90,6 @@ def init_sdk(timeout_warning=False, **extra_init_args):
 
 @pytest.fixture
 def lambda_client():
-    if "SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID" not in os.environ:
-        pytest.skip("AWS environ vars not set")
-
     from tests.integrations.aws_lambda.client import get_boto_client
 
     return get_boto_client()
diff --git a/tox.ini b/tox.ini
index bf72e22c6e..f182e14ee8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -569,9 +569,6 @@ setenv =
 
     COVERAGE_FILE=.coverage-{envname}
 passenv =
-    SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID
-    SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY
-    SENTRY_PYTHON_TEST_AWS_IAM_ROLE
     SENTRY_PYTHON_TEST_POSTGRES_USER
     SENTRY_PYTHON_TEST_POSTGRES_PASSWORD
     SENTRY_PYTHON_TEST_POSTGRES_NAME

From e49a0b7789da98f4d0eb99a7eb3dc9842a09a221 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 09:56:04 +0200
Subject: [PATCH 12/62] Cleanup

---
 scripts/aws-cleanup.sh                                | 11 -----------
 .../split-tox-gh-actions/ci-yaml-setup-localstack.txt |  7 +++++++
 2 files changed, 7 insertions(+), 11 deletions(-)
 delete mode 100755 scripts/aws-cleanup.sh
 create mode 100644 scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt

diff --git a/scripts/aws-cleanup.sh b/scripts/aws-cleanup.sh
deleted file mode 100755
index 1219668855..0000000000
--- a/scripts/aws-cleanup.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# Delete all AWS Lambda functions
-
-export AWS_ACCESS_KEY_ID="$SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"
-export AWS_SECRET_ACCESS_KEY="$SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"
-export AWS_IAM_ROLE="$SENTRY_PYTHON_TEST_AWS_IAM_ROLE"
-
-for func in $(aws lambda list-functions | jq -r .Functions[].FunctionName); do
-    echo "Deleting $func"
-    aws lambda delete-function --function-name $func
-done
diff --git a/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt b/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt
new file mode 100644
index 0000000000..195de98696
--- /dev/null
+++ b/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt
@@ -0,0 +1,7 @@
+          pip install localstack                    # install LocalStack cli
+          docker pull localstack/localstack         # Make sure to pull the latest version of the image
+          localstack start -d                       # Start LocalStack in the background
+
+          echo "Waiting for LocalStack startup..."  # Wait 30 seconds for the LocalStack container
+          localstack wait -t 30                     # to become ready before timing out
+          echo "Startup complete"

From 386edeb578cf54c497079190d1fa92a80440d719 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 09:57:25 +0200
Subject: [PATCH 13/62] more cleanup

---
 .github/workflows/test-integration-aws_lambda.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index d2f8d199be..575bb47e4f 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -54,6 +54,7 @@ jobs:
           echo "Waiting for LocalStack startup..."  # Wait 30 seconds for the LocalStack container
           localstack wait -t 30                     # to become ready before timing out
           echo "Startup complete"
+
       - name: Test aws_lambda
         uses: nick-fields/retry@v2
         with:

From 6f6dd978aa28d19e80fd5a02c57ecd5e6f4ec61d Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 10:09:43 +0200
Subject: [PATCH 14/62] Added region to AWS client

---
 tests/integrations/aws_lambda/client.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 50198108fb..e902c1f970 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -7,13 +7,14 @@
 import uuid
 import base64
 
-
+AWS_REGION_NAME = "us-east-1"
 AWS_ENDPOINT_LOCALSTACK = "http://localhost:4566"
 AWS_LAMBDA_EXECUTION_ROLE_ARN = None
 
 
 def get_or_create_lambda_execution_role():
     global AWS_LAMBDA_EXECUTION_ROLE_ARN
+
     role_name = "lambda-ex"
     policy = """
     {
@@ -29,7 +30,11 @@ def get_or_create_lambda_execution_role():
         ]
     }
     """
-    iam_client = boto3.client("iam", endpoint_url=AWS_ENDPOINT_LOCALSTACK)
+    iam_client = boto3.client(
+        "iam",
+        endpoint_url=AWS_ENDPOINT_LOCALSTACK,
+        region_name=AWS_REGION_NAME,
+    )
 
     try:
         response = iam_client.get_role(RoleName=role_name)
@@ -55,6 +60,7 @@ def get_boto_client():
     return boto3.client(
         "lambda",
         endpoint_url=AWS_ENDPOINT_LOCALSTACK,
+        region_name=AWS_REGION_NAME,
     )
 
 

From 2e041b1701734f0d50e5a794fb66b9573723af81 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 10:33:51 +0200
Subject: [PATCH 15/62] Trying something

---
 .../ci-yaml-setup-localstack.txt                    |  5 ++++-
 tests/integrations/aws_lambda/client.py             | 13 ++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt b/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt
index 195de98696..0cbdc54f87 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt
@@ -1,7 +1,10 @@
-          pip install localstack                    # install LocalStack cli
+          pip install localstack awscli-local[ver1] # install LocalStack cli
           docker pull localstack/localstack         # Make sure to pull the latest version of the image
           localstack start -d                       # Start LocalStack in the background
 
           echo "Waiting for LocalStack startup..."  # Wait 30 seconds for the LocalStack container
           localstack wait -t 30                     # to become ready before timing out
           echo "Startup complete"
+
+          awslocal lambda list-functions
+          echo "done listing functions"
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index e902c1f970..7618479f26 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -7,9 +7,14 @@
 import uuid
 import base64
 
+
 AWS_REGION_NAME = "us-east-1"
 AWS_ENDPOINT_LOCALSTACK = "http://localhost:4566"
 AWS_LAMBDA_EXECUTION_ROLE_ARN = None
+AWS_FAKE_CREDS_FOR_LOCALSTACK = {
+    "aws_access_key_id": "foobar",
+    "aws_secret_access_key": "foobar",
+}
 
 
 def get_or_create_lambda_execution_role():
@@ -34,6 +39,7 @@ def get_or_create_lambda_execution_role():
         "iam",
         endpoint_url=AWS_ENDPOINT_LOCALSTACK,
         region_name=AWS_REGION_NAME,
+        **AWS_FAKE_CREDS_FOR_LOCALSTACK,
     )
 
     try:
@@ -61,6 +67,7 @@ def get_boto_client():
         "lambda",
         endpoint_url=AWS_ENDPOINT_LOCALSTACK,
         region_name=AWS_REGION_NAME,
+        **AWS_FAKE_CREDS_FOR_LOCALSTACK,
     )
 
 
@@ -151,14 +158,14 @@ def run_lambda_function(
 
             subprocess.check_call(
                 [sys.executable, "setup.py", "sdist", "-d", os.path.join(tmpdir, "..")],
-                **subprocess_kwargs
+                **subprocess_kwargs,
             )
 
             subprocess.check_call(
                 "pip install mock==3.0.0 funcsigs -t .",
                 cwd=tmpdir,
                 shell=True,
-                **subprocess_kwargs
+                **subprocess_kwargs,
             )
 
             # https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
@@ -166,7 +173,7 @@ def run_lambda_function(
                 "pip install ../*.tar.gz -t .",
                 cwd=tmpdir,
                 shell=True,
-                **subprocess_kwargs
+                **subprocess_kwargs,
             )
 
             shutil.make_archive(os.path.join(tmpdir, "ball"), "zip", tmpdir)

From 46b1f7a93481e6fdb70be1dfd6cfac9e86cf4e36 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 10:35:46 +0200
Subject: [PATCH 16/62] update test matrix

---
 .github/workflows/test-integration-aws_lambda.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index 575bb47e4f..f0222796cc 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -47,7 +47,7 @@ jobs:
       - name: Setup Test Env
         run: |
           pip install coverage "tox>=3,<4"
-          pip install localstack                    # install LocalStack cli
+          pip install localstack awscli-local[ver1] # install LocalStack cli
           docker pull localstack/localstack         # Make sure to pull the latest version of the image
           localstack start -d                       # Start LocalStack in the background
 
@@ -55,6 +55,9 @@ jobs:
           localstack wait -t 30                     # to become ready before timing out
           echo "Startup complete"
 
+          awslocal lambda list-functions
+          echo "done listing functions"
+
       - name: Test aws_lambda
         uses: nick-fields/retry@v2
         with:

From 4391d9bde759f71689dd0d972e46e29acc9e2bcc Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 14:07:06 +0200
Subject: [PATCH 17/62] Speeding up test by only creating the same lambda
 function once

---
 tests/integrations/aws_lambda/client.py | 48 ++++++++++++++++---------
 1 file changed, 31 insertions(+), 17 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 7618479f26..7c45403361 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -4,7 +4,6 @@
 import tempfile
 import subprocess
 import boto3
-import uuid
 import base64
 
 
@@ -122,9 +121,28 @@ def run_lambda_function(
     initial_handler=None,
     subprocess_kwargs=(),
 ):
+    """
+    Creates a Lambda function with the given code, and invoces it.
+
+    If the same code is run multiple times the function will NOT be
+    created anew each time but the existing function will be reused.
+    """
     subprocess_kwargs = dict(subprocess_kwargs)
 
-    with tempfile.TemporaryDirectory() as tmpdir:
+    dir_prefix = str(hash(code))
+    fn_name = "test_function_{}".format(dir_prefix)
+
+    tmp_base_dir = tempfile.gettempdir()
+    dir_already_existing = any(
+        [x.startswith(fn_name) for x in os.listdir(tmp_base_dir)]
+    )
+
+    if dir_already_existing:
+        print("Lambda function directory already exists, skipping creation")
+
+    if not dir_already_existing:
+        tmpdir = tempfile.mkdtemp(prefix="%s-" % fn_name)
+
         if initial_handler:
             # If Initial handler value is provided i.e. it is not the default
             # `test_lambda.test_handler`, then create another dir level so that our path is
@@ -149,8 +167,6 @@ def run_lambda_function(
             # such as chalice's)
             subprocess.check_call([sys.executable, test_lambda_py])
 
-        fn_name = "test_function_{}".format(uuid.uuid4())
-
         if layer is None:
             setup_cfg = os.path.join(tmpdir, "setup.cfg")
             with open(setup_cfg, "w") as f:
@@ -206,8 +222,6 @@ def run_lambda_function(
 
         @add_finalizer
         def clean_up():
-            client.delete_function(FunctionName=fn_name)
-
             # this closes the web socket so we don't get a
             #   ResourceWarning: unclosed <ssl.SSLSocket ... >
             # warning on every test
@@ -221,18 +235,18 @@ def clean_up():
         waiter = client.get_waiter("function_active_v2")
         waiter.wait(FunctionName=fn_name)
 
-        response = client.invoke(
-            FunctionName=fn_name,
-            InvocationType="RequestResponse",
-            LogType="Tail",
-            Payload=payload,
-        )
+    response = client.invoke(
+        FunctionName=fn_name,
+        InvocationType="RequestResponse",
+        LogType="Tail",
+        Payload=payload,
+    )
 
-        assert (
-            response is not None
-        ), "Failed to create Lambda function in time (max retries exceeded)"
-        assert 200 <= response["StatusCode"] < 300, response
-        return response
+    assert (
+        response is not None
+    ), "Failed to create Lambda function in time (max retries exceeded)"
+    assert 200 <= response["StatusCode"] < 300, response
+    return response
 
 
 _REPL_CODE = """

From c15ad179800ee352430d86812c017fc879387809 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 14:23:43 +0200
Subject: [PATCH 18/62] Some cleanup

---
 tests/integrations/aws_lambda/test_aws.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index d358e854ee..2fde9464e5 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -353,7 +353,7 @@ def test_handler(event, context):
 
     (envelope,) = envelopes
     assert envelope["type"] == "transaction"
-    assert envelope["contexts"]["trace"]["op"] == "function.aws.lambda"
+    assert envelope["contexts"]["trace"]["op"] == "function.aws"
     assert envelope["transaction"].startswith("test_function_")
     assert envelope["transaction_info"] == {"source": "component"}
     assert envelope["transaction"] in envelope["request"]["url"]
@@ -382,7 +382,7 @@ def test_handler(event, context):
     (envelope,) = envelopes
 
     assert envelope["type"] == "transaction"
-    assert envelope["contexts"]["trace"]["op"] == "function.aws.lambda"
+    assert envelope["contexts"]["trace"]["op"] == "function.aws"
     assert envelope["transaction"].startswith("test_function_")
     assert envelope["transaction_info"] == {"source": "component"}
     assert envelope["transaction"] in envelope["request"]["url"]
@@ -467,9 +467,9 @@ def test_handler(event, context):
 
     assert response["FunctionError"] == "Unhandled"
 
-    error_event = events[0]
+    (error_event,) = events
     assert error_event["level"] == "error"
-    assert error_event["contexts"]["trace"]["op"] == "function.aws.lambda"
+    assert error_event["contexts"]["trace"]["op"] == "function.aws"
 
     function_name = error_event["extra"]["lambda"]["function_name"]
     assert function_name.startswith("test_function_")

From 6de3340b481453baaf66905f7046806a5b7acfa1 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 16:30:47 +0200
Subject: [PATCH 19/62] Fixed some tests

---
 tests/integrations/aws_lambda/test_aws.py | 118 +++++++++++-----------
 1 file changed, 58 insertions(+), 60 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 2fde9464e5..e90368bb7c 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -45,7 +45,6 @@ def event_processor(event):
     event_data["level"] = event.get("level")
     event_data["request"] = event.get("request")
     event_data["tags"] = event.get("tags")
-    event_data["transaction"] = event.get("transaction")
 
     return event_data
 
@@ -55,17 +54,30 @@ def envelope_processor(envelope):
     # in full, so only grab the data we need.
 
     (item,) = envelope.items
-    envelope_json = json.loads(item.get_bytes())
-
-    envelope_data = {}
-    envelope_data["contexts"] = {}
-    envelope_data["type"] = envelope_json["type"]
-    envelope_data["transaction"] = envelope_json["transaction"]
-    envelope_data["contexts"]["trace"] = envelope_json["contexts"]["trace"]
-    envelope_data["request"] = envelope_json["request"]
-    envelope_data["tags"] = envelope_json["tags"]
+    item_json = json.loads(item.get_bytes())
+
+    if item_json.get("type") == "transaction":
+        envelope_data = {}
+        envelope_data["type"] = item_json["type"]
+        envelope_data["contexts"] = {}
+        envelope_data["contexts"]["trace"] = item_json["contexts"]["trace"]
+        envelope_data["transaction"] = item_json["transaction"]
+        envelope_data["request"] = item_json["request"]
+        envelope_data["tags"] = item_json["tags"]
+
+        return envelope_data
+    else:
+        event_data = {}
+        event_data["contexts"] = {}
+        event_data["contexts"]["trace"] = item_json.get("contexts", {}).get("trace")
+        event_data["transaction"] = item_json.get("transaction")
+        event_data["exception"] = item_json.get("exception")
+        event_data["extra"] = item_json.get("extra")
+        event_data["level"] = item_json.get("level")
+        event_data["request"] = item_json.get("request")
+        event_data["tags"] = item_json.get("tags")
 
-    return envelope_data
+        return event_data
 
 
 class TestTransport(HttpTransport):
@@ -75,7 +87,10 @@ def _send_event(self, event):
 
     def _send_envelope(self, envelope):
         envelope = envelope_processor(envelope)
-        print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
+        if envelope.get("type") == "transaction":
+            print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
+        else:
+            print("\\nEVENT: {}\\n".format(json.dumps(envelope)))
 
 def init_sdk(timeout_warning=False, **extra_init_args):
     sentry_sdk.init(
@@ -83,6 +98,7 @@ def init_sdk(timeout_warning=False, **extra_init_args):
         transport=TestTransport,
         integrations=[AwsLambdaIntegration(timeout_warning=timeout_warning)],
         shutdown_timeout=10,
+        debug=False,
         **extra_init_args
     )
 """
@@ -156,13 +172,8 @@ def test_basic(run_lambda_function):
             """
         init_sdk()
 
-        def event_processor(event):
-            # Delay event output like this to test proper shutdown
-            time.sleep(1)
-            return event
-
         def test_handler(event, context):
-            raise Exception("something went wrong")
+            raise Exception("Oh!")
         """
         ),
         b'{"foo": "bar"}',
@@ -174,7 +185,7 @@ def test_handler(event, context):
     assert event["level"] == "error"
     (exception,) = event["exception"]["values"]
     assert exception["type"] == "Exception"
-    assert exception["value"] == "something went wrong"
+    assert exception["value"] == "Oh!"
 
     (frame1,) = exception["stacktrace"]["frames"]
     assert frame1["filename"] == "test_lambda.py"
@@ -212,7 +223,7 @@ def test_initialization_order(run_lambda_function):
             """
             def test_handler(event, context):
                 init_sdk()
-                sentry_sdk.capture_exception(Exception("something went wrong"))
+                sentry_sdk.capture_exception(Exception("Oh!"))
         """
         ),
         b'{"foo": "bar"}',
@@ -222,7 +233,7 @@ def test_handler(event, context):
     assert event["level"] == "error"
     (exception,) = event["exception"]["values"]
     assert exception["type"] == "Exception"
-    assert exception["value"] == "something went wrong"
+    assert exception["value"] == "Oh!"
 
 
 def test_request_data(run_lambda_function):
@@ -243,7 +254,7 @@ def test_handler(event, context):
           "httpMethod": "GET",
           "headers": {
             "Host": "iwsz2c7uwi.execute-api.us-east-1.amazonaws.com",
-            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:62.0) Gecko/20100101 Firefox/62.0",
+            "User-Agent": "custom",
             "X-Forwarded-Proto": "https"
           },
           "queryStringParameters": {
@@ -268,7 +279,7 @@ def test_handler(event, context):
     assert event["request"] == {
         "headers": {
             "Host": "iwsz2c7uwi.execute-api.us-east-1.amazonaws.com",
-            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:62.0) Gecko/20100101 Firefox/62.0",
+            "User-Agent": "custom",
             "X-Forwarded-Proto": "https",
         },
         "method": "GET",
@@ -279,13 +290,7 @@ def test_handler(event, context):
 
 def test_init_error(run_lambda_function, lambda_runtime):
     envelopes, events, response = run_lambda_function(
-        LAMBDA_PRELUDE
-        + (
-            "def event_processor(event):\n"
-            '    return event["exception"]["values"][0]["value"]\n'
-            "init_sdk()\n"
-            "func()"
-        ),
+        LAMBDA_PRELUDE + ("init_sdk()\n" "func()"),
         b'{"foo": "bar"}',
         syntax_check=False,
     )
@@ -352,10 +357,10 @@ def test_handler(event, context):
     )
 
     (envelope,) = envelopes
+
     assert envelope["type"] == "transaction"
     assert envelope["contexts"]["trace"]["op"] == "function.aws"
     assert envelope["transaction"].startswith("test_function_")
-    assert envelope["transaction_info"] == {"source": "component"}
     assert envelope["transaction"] in envelope["request"]["url"]
 
 
@@ -367,7 +372,7 @@ def test_performance_error(run_lambda_function):
         init_sdk(traces_sample_rate=1.0)
 
         def test_handler(event, context):
-            raise Exception("something went wrong")
+            raise Exception("Oh!")
         """
         ),
         b'{"foo": "bar"}',
@@ -377,14 +382,13 @@ def test_handler(event, context):
     assert event["level"] == "error"
     (exception,) = event["exception"]["values"]
     assert exception["type"] == "Exception"
-    assert exception["value"] == "something went wrong"
+    assert exception["value"] == "Oh!"
 
     (envelope,) = envelopes
 
     assert envelope["type"] == "transaction"
     assert envelope["contexts"]["trace"]["op"] == "function.aws"
     assert envelope["transaction"].startswith("test_function_")
-    assert envelope["transaction_info"] == {"source": "component"}
     assert envelope["transaction"] in envelope["request"]["url"]
 
 
@@ -412,29 +416,25 @@ def test_handler(event, context):
             [
                 {
                     "headers": {
-                        "Host": "dogs.are.great",
+                        "Host": "x.io",
                         "X-Forwarded-Proto": "http"
                     },
                     "httpMethod": "GET",
-                    "path": "/tricks/kangaroo",
+                    "path": "/somepath",
                     "queryStringParameters": {
-                        "completed_successfully": "true",
-                        "treat_provided": "true",
-                        "treat_type": "cheese"
+                        "done": "true"
                     },
                     "dog": "Maisey"
                 },
                 {
                     "headers": {
-                        "Host": "dogs.are.great",
+                        "Host": "x.io",
                         "X-Forwarded-Proto": "http"
                     },
                     "httpMethod": "GET",
-                    "path": "/tricks/kangaroo",
+                    "path": "/somepath",
                     "queryStringParameters": {
-                        "completed_successfully": "true",
-                        "treat_provided": "true",
-                        "treat_type": "cheese"
+                        "done": "true"
                     },
                     "dog": "Charlie"
                 }
@@ -459,7 +459,7 @@ def test_non_dict_event(
         init_sdk(traces_sample_rate=1.0)
 
         def test_handler(event, context):
-            raise Exception("More treats, please!")
+            raise Exception("Oh?")
         """
         ),
         aws_event,
@@ -477,10 +477,10 @@ def test_handler(event, context):
 
     exception = error_event["exception"]["values"][0]
     assert exception["type"] == "Exception"
-    assert exception["value"] == "More treats, please!"
+    assert exception["value"] == "Oh?"
     assert exception["mechanism"]["type"] == "aws_lambda"
 
-    envelope = envelopes[0]
+    (envelope,) = envelopes
     assert envelope["type"] == "transaction"
     assert envelope["contexts"]["trace"] == DictionaryContaining(
         error_event["contexts"]["trace"]
@@ -491,13 +491,11 @@ def test_handler(event, context):
 
     if has_request_data:
         request_data = {
-            "headers": {"Host": "dogs.are.great", "X-Forwarded-Proto": "http"},
+            "headers": {"Host": "x.io", "X-Forwarded-Proto": "http"},
             "method": "GET",
-            "url": "http://dogs.are.great/tricks/kangaroo",
+            "url": "http://x.io/somepath",
             "query_string": {
-                "completed_successfully": "true",
-                "treat_provided": "true",
-                "treat_type": "cheese",
+                "done": "true",
             },
         }
     else:
@@ -582,7 +580,7 @@ def test_handler(event, context):
                                 "aws_event": DictionaryContaining({
                                     "httpMethod": "GET",
                                     "path": "/sit/stay/rollover",
-                                    "headers": {"Host": "dogs.are.great", "X-Forwarded-Proto": "http"},
+                                    "headers": {"Host": "x.io", "X-Forwarded-Proto": "http"},
                                 }),
                                 "aws_context": ObjectDescribedBy(
                                     type=get_lambda_bootstrap().LambdaContext,
@@ -609,7 +607,7 @@ def test_handler(event, context):
             )
         """
         ),
-        b'{"httpMethod": "GET", "path": "/sit/stay/rollover", "headers": {"Host": "dogs.are.great", "X-Forwarded-Proto": "http"}}',
+        b'{"httpMethod": "GET", "path": "/sit/stay/rollover", "headers": {"Host": "x.io", "X-Forwarded-Proto": "http"}}',
     )
 
     assert response["Payload"]["AssertionError raised"] is False
@@ -641,7 +639,7 @@ def test_handler(event, context):
                 assert isinstance(current_client.options['integrations'][0],
                                   sentry_sdk.integrations.aws_lambda.AwsLambdaIntegration)
 
-                raise Exception("something went wrong")
+                raise Exception("Oh!")
             """
             ),
             b'{"foo": "bar"}',
@@ -654,7 +652,7 @@ def test_handler(event, context):
         assert response["Payload"]["errorType"] != "AssertionError"
 
         assert response["Payload"]["errorType"] == "Exception"
-        assert response["Payload"]["errorMessage"] == "something went wrong"
+        assert response["Payload"]["errorMessage"] == "Oh!"
 
         assert "sentry_handler" in response["LogResult"][3].decode("utf-8")
 
@@ -668,7 +666,7 @@ def test_error_has_new_trace_context_performance_enabled(run_lambda_function):
 
         def test_handler(event, context):
             sentry_sdk.capture_message("hi")
-            raise Exception("something went wrong")
+            raise Exception("Oh!")
         """
         ),
         payload=b'{"foo": "bar"}',
@@ -701,7 +699,7 @@ def test_error_has_new_trace_context_performance_disabled(run_lambda_function):
 
         def test_handler(event, context):
             sentry_sdk.capture_message("hi")
-            raise Exception("something went wrong")
+            raise Exception("Oh!")
         """
         ),
         payload=b'{"foo": "bar"}',
@@ -735,7 +733,7 @@ def test_error_has_existing_trace_context_performance_enabled(run_lambda_functio
 
         def test_handler(event, context):
             sentry_sdk.capture_message("hi")
-            raise Exception("something went wrong")
+            raise Exception("Oh!")
         """
         ),
         payload=b'{"sentry_trace": "%s"}' % sentry_trace_header.encode(),
@@ -774,7 +772,7 @@ def test_error_has_existing_trace_context_performance_disabled(run_lambda_functi
 
         def test_handler(event, context):
             sentry_sdk.capture_message("hi")
-            raise Exception("something went wrong")
+            raise Exception("Oh!")
         """
         ),
         payload=b'{"sentry_trace": "%s"}' % sentry_trace_header.encode(),

From c8e721a9904676ce496762a6f323017a2765622b Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Thu, 19 Oct 2023 16:46:45 +0200
Subject: [PATCH 20/62] Cleanup

---
 tests/integrations/aws_lambda/test_aws.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index e90368bb7c..7703e724ba 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -98,7 +98,6 @@ def init_sdk(timeout_warning=False, **extra_init_args):
         transport=TestTransport,
         integrations=[AwsLambdaIntegration(timeout_warning=timeout_warning)],
         shutdown_timeout=10,
-        debug=False,
         **extra_init_args
     )
 """
@@ -290,7 +289,11 @@ def test_handler(event, context):
 
 def test_init_error(run_lambda_function, lambda_runtime):
     envelopes, events, response = run_lambda_function(
-        LAMBDA_PRELUDE + ("init_sdk()\n" "func()"),
+        LAMBDA_PRELUDE
+        + (
+            "init_sdk()\n",
+            "func()",
+        ),
         b'{"foo": "bar"}',
         syntax_check=False,
     )
@@ -625,7 +628,7 @@ def test_serverless_no_code_instrumentation(run_lambda_function):
         "test_dir.test_lambda.test_handler",
     ]:
         print("Testing Initial Handler ", initial_handler)
-        _, _, response = run_lambda_function(
+        envelopes, events, response = run_lambda_function(
             dedent(
                 """
             import sentry_sdk
@@ -658,7 +661,7 @@ def test_handler(event, context):
 
 
 def test_error_has_new_trace_context_performance_enabled(run_lambda_function):
-    envelopes, _, _ = run_lambda_function(
+    envelopes, events, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -691,7 +694,7 @@ def test_handler(event, context):
 
 
 def test_error_has_new_trace_context_performance_disabled(run_lambda_function):
-    _, events, _ = run_lambda_function(
+    envelopes, events, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -725,7 +728,7 @@ def test_error_has_existing_trace_context_performance_enabled(run_lambda_functio
     parent_sampled = 1
     sentry_trace_header = "{}-{}-{}".format(trace_id, parent_span_id, parent_sampled)
 
-    envelopes, _, _ = run_lambda_function(
+    envelopes, events, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -764,7 +767,7 @@ def test_error_has_existing_trace_context_performance_disabled(run_lambda_functi
     parent_sampled = 1
     sentry_trace_header = "{}-{}-{}".format(trace_id, parent_span_id, parent_sampled)
 
-    _, events, _ = run_lambda_function(
+    envelopes, events, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """

From 3a051e174e164ebbdc7b88aaa461a14bb809ab04 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Fri, 20 Oct 2023 10:43:34 +0200
Subject: [PATCH 21/62] Updated some tests

---
 tests/integrations/aws_lambda/test_aws.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 7703e724ba..784fa5623c 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -79,7 +79,6 @@ def envelope_processor(envelope):
 
         return event_data
 
-
 class TestTransport(HttpTransport):
     def _send_event(self, event):
         event = event_processor(event)
@@ -290,9 +289,11 @@ def test_handler(event, context):
 def test_init_error(run_lambda_function, lambda_runtime):
     envelopes, events, response = run_lambda_function(
         LAMBDA_PRELUDE
-        + (
-            "init_sdk()\n",
-            "func()",
+        + dedent(
+            """
+        init_sdk()
+        func()
+        """
         ),
         b'{"foo": "bar"}',
         syntax_check=False,
@@ -315,7 +316,7 @@ def test_handler(event, context):
         """
         ),
         b'{"foo": "bar"}',
-        timeout=3,
+        timeout=2,
     )
 
     (event,) = events
@@ -323,8 +324,8 @@ def test_handler(event, context):
     (exception,) = event["exception"]["values"]
     assert exception["type"] == "ServerlessTimeoutWarning"
     assert exception["value"] in (
-        "WARNING : Function is expected to get timed out. Configured timeout duration = 4 seconds.",
         "WARNING : Function is expected to get timed out. Configured timeout duration = 3 seconds.",
+        "WARNING : Function is expected to get timed out. Configured timeout duration = 2 seconds.",
     )
 
     assert exception["mechanism"]["type"] == "threading"

From 6e6dfc7830983d7a41c666d387ef08252b5ff4ef Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Fri, 20 Oct 2023 12:48:22 +0200
Subject: [PATCH 22/62] Fixed some tests (not really, because localstack does
 not support layers in the community editition, but in real AWS lambda it
 should work.

---
 scripts/build_aws_lambda_layer.py       | 35 +++++++++++++++++++------
 tests/integrations/aws_lambda/client.py |  6 +++--
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/scripts/build_aws_lambda_layer.py b/scripts/build_aws_lambda_layer.py
index d551097649..64f1e8105f 100644
--- a/scripts/build_aws_lambda_layer.py
+++ b/scripts/build_aws_lambda_layer.py
@@ -1,10 +1,15 @@
 import os
 import shutil
 import subprocess
+import sys
 import tempfile
+from typing import TYPE_CHECKING
 
 from sentry_sdk.consts import VERSION as SDK_VERSION
 
+if TYPE_CHECKING:
+    from typing import Optional
+
 DIST_PATH = "dist"  # created by "make dist" that is called by "make aws-lambda-layer"
 PYTHON_SITE_PACKAGES = "python"  # see https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-path
 
@@ -13,11 +18,16 @@ class LayerBuilder:
     def __init__(
         self,
         base_dir,  # type: str
+        out_zip_filename=None,  # type: Optional[str]
     ):
         # type: (...) -> None
         self.base_dir = base_dir
         self.python_site_packages = os.path.join(self.base_dir, PYTHON_SITE_PACKAGES)
-        self.out_zip_filename = f"sentry-python-serverless-{SDK_VERSION}.zip"
+        self.out_zip_filename = (
+            f"sentry-python-serverless-{SDK_VERSION}.zip"
+            if out_zip_filename is None
+            else out_zip_filename
+        )
 
     def make_directories(self):
         # type: (...) -> None
@@ -80,13 +90,22 @@ def zip(self):
         )
 
 
-def build_packaged_zip():
-    with tempfile.TemporaryDirectory() as base_dir:
-        layer_builder = LayerBuilder(base_dir)
-        layer_builder.make_directories()
-        layer_builder.install_python_packages()
-        layer_builder.create_init_serverless_sdk_package()
-        layer_builder.zip()
+def build_packaged_zip(dest_abs_path=None, make_dist=False, out_zip_filename=None):
+    if dest_abs_path is None:
+        dest_abs_path = tempfile.mkdtemp()
+
+    if make_dist:
+        subprocess.check_call(
+            [sys.executable, "setup.py", "sdist", "bdist_wheel", "-d", DIST_PATH],
+        )
+
+    layer_builder = LayerBuilder(dest_abs_path, out_zip_filename=out_zip_filename)
+    layer_builder.make_directories()
+    layer_builder.install_python_packages()
+    layer_builder.create_init_serverless_sdk_package()
+    layer_builder.zip()
+
+    shutil.rmtree(dest_abs_path)
 
 
 if __name__ == "__main__":
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 7c45403361..1c6269834a 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -78,9 +78,11 @@ def build_no_code_serverless_function_and_layer(
     sdk by creating a layer containing the Python-sdk, and then creating a func
     that uses that layer
     """
-    from scripts.build_aws_lambda_layer import build_layer_dir
+    from scripts.build_aws_lambda_layer import build_packaged_zip
 
-    build_layer_dir(dest_abs_path=tmpdir)
+    build_packaged_zip(
+        dest_abs_path=tmpdir, make_dist=True, out_zip_filename="serverless-ball.zip"
+    )
 
     with open(os.path.join(tmpdir, "serverless-ball.zip"), "rb") as serverless_zip:
         response = client.publish_layer_version(

From 4d0d5b0797ed4104cee76ec61c78ca4008b7faf0 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Fri, 20 Oct 2023 14:07:32 +0200
Subject: [PATCH 23/62] Fixed more tests

---
 tests/integrations/aws_lambda/test_aws.py | 97 ++++++++++++++---------
 1 file changed, 58 insertions(+), 39 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 784fa5623c..a6af9fbe08 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -32,52 +32,74 @@
 
 from sentry_sdk.transport import HttpTransport
 
-def event_processor(event):
+def truncate_data(data):
     # AWS Lambda truncates the log output to 4kb, which is small enough to miss
     # parts of even a single error-event/transaction-envelope pair if considered
     # in full, so only grab the data we need.
 
-    event_data = {}
-    event_data["contexts"] = {}
-    event_data["contexts"]["trace"] = event.get("contexts", {}).get("trace")
-    event_data["exception"] = event.get("exception")
-    event_data["extra"] = event.get("extra")
-    event_data["level"] = event.get("level")
-    event_data["request"] = event.get("request")
-    event_data["tags"] = event.get("tags")
+    cleaned_data = {}
 
-    return event_data
+    if data.get("type") is not None:
+        cleaned_data["type"] = data["type"]
 
-def envelope_processor(envelope):
-    # AWS Lambda truncates the log output to 4kb, which is small enough to miss
-    # parts of even a single error-event/transaction-envelope pair if considered
-    # in full, so only grab the data we need.
+    if data.get("contexts") is not None:
+        cleaned_data["contexts"] = {}
+
+        if data["contexts"].get("trace") is not None:
+            cleaned_data["contexts"]["trace"] = data["contexts"].get("trace")
+
+    if data.get("transaction") is not None:
+        cleaned_data["transaction"] = data.get("transaction")
+
+    if data.get("request") is not None:
+        cleaned_data["request"] = data.get("request")
+
+    if data.get("tags") is not None:
+        cleaned_data["tags"] = data.get("tags")
+
+    if data.get("exception") is not None:
+        cleaned_data["exception"] = data.get("exception")
+
+        for value in cleaned_data["exception"]["values"]:
+            for frame in value["stacktrace"]["frames"]:
+                del frame["vars"]
+                del frame["pre_context"]
+                del frame["context_line"]
+                del frame["post_context"]
 
+    if data.get("extra") is not None:
+        cleaned_data["extra"] = {}
+
+        for key in data["extra"].keys():
+            if key == "lambda":
+                for lambda_key in data["extra"]["lambda"].keys():
+                    if lambda_key in ["function_name"]:
+                        cleaned_data["extra"].setdefault("lambda", {})[lambda_key] = data["extra"]["lambda"][lambda_key]
+            elif key == "cloudwatch logs":
+                for cloudwatch_key in data["extra"]["cloudwatch logs"].keys():
+                    if cloudwatch_key in ["url", "log_group", "log_stream"]:
+                        cleaned_data["extra"].setdefault("cloudwatch logs", {})[cloudwatch_key] = data["extra"]["cloudwatch logs"][cloudwatch_key]
+
+    if data.get("level") is not None:
+        cleaned_data["level"] = data.get("level")
+
+    if data.get("message") is not None:
+        cleaned_data["message"] = data.get("message")
+
+    if "contexts" not in cleaned_data:
+        raise Exception(json.dumps(data))
+
+    return cleaned_data
+
+def event_processor(event):
+    return truncate_data(event)
+
+def envelope_processor(envelope):
     (item,) = envelope.items
     item_json = json.loads(item.get_bytes())
 
-    if item_json.get("type") == "transaction":
-        envelope_data = {}
-        envelope_data["type"] = item_json["type"]
-        envelope_data["contexts"] = {}
-        envelope_data["contexts"]["trace"] = item_json["contexts"]["trace"]
-        envelope_data["transaction"] = item_json["transaction"]
-        envelope_data["request"] = item_json["request"]
-        envelope_data["tags"] = item_json["tags"]
+    return truncate_data(item_json)
 
-        return envelope_data
-    else:
-        event_data = {}
-        event_data["contexts"] = {}
-        event_data["contexts"]["trace"] = item_json.get("contexts", {}).get("trace")
-        event_data["transaction"] = item_json.get("transaction")
-        event_data["exception"] = item_json.get("exception")
-        event_data["extra"] = item_json.get("extra")
-        event_data["level"] = item_json.get("level")
-        event_data["request"] = item_json.get("request")
-        event_data["tags"] = item_json.get("tags")
-
-        return event_data
 
 class TestTransport(HttpTransport):
     def _send_event(self, event):
@@ -86,10 +108,7 @@ def _send_event(self, event):
 
     def _send_envelope(self, envelope):
         envelope = envelope_processor(envelope)
-        if envelope.get("type") == "transaction":
-            print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
-        else:
-            print("\\nEVENT: {}\\n".format(json.dumps(envelope)))
+        print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
 
 def init_sdk(timeout_warning=False, **extra_init_args):
     sentry_sdk.init(

From 1e0f5f41eda4f181437f51d58a5bc05c260fbe49 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Fri, 20 Oct 2023 14:39:16 +0200
Subject: [PATCH 24/62] Fixed some tests

---
 tests/integrations/aws_lambda/test_aws.py | 45 +++++++++++++----------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index a6af9fbe08..7f3afa4d2e 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -61,7 +61,7 @@ def truncate_data(data):
         cleaned_data["exception"] = data.get("exception")
 
         for value in cleaned_data["exception"]["values"]:
-            for frame in value["stacktrace"]["frames"]:
+            for frame in value.get("stacktrace", {}).get("frames", []):
                 del frame["vars"]
                 del frame["pre_context"]
                 del frame["context_line"]
@@ -247,6 +247,7 @@ def test_handler(event, context):
     )
 
     (event,) = events
+
     assert event["level"] == "error"
     (exception,) = event["exception"]["values"]
     assert exception["type"] == "Exception"
@@ -401,18 +402,20 @@ def test_handler(event, context):
         b'{"foo": "bar"}',
     )
 
-    (event,) = events
-    assert event["level"] == "error"
-    (exception,) = event["exception"]["values"]
+    (
+        error_event,
+        transaction_event,
+    ) = envelopes
+
+    assert error_event["level"] == "error"
+    (exception,) = error_event["exception"]["values"]
     assert exception["type"] == "Exception"
     assert exception["value"] == "Oh!"
 
-    (envelope,) = envelopes
-
-    assert envelope["type"] == "transaction"
-    assert envelope["contexts"]["trace"]["op"] == "function.aws"
-    assert envelope["transaction"].startswith("test_function_")
-    assert envelope["transaction"] in envelope["request"]["url"]
+    assert transaction_event["type"] == "transaction"
+    assert transaction_event["contexts"]["trace"]["op"] == "function.aws"
+    assert transaction_event["transaction"].startswith("test_function_")
+    assert transaction_event["transaction"] in transaction_event["request"]["url"]
 
 
 @pytest.mark.parametrize(
@@ -490,7 +493,10 @@ def test_handler(event, context):
 
     assert response["FunctionError"] == "Unhandled"
 
-    (error_event,) = events
+    (
+        error_event,
+        transaction_event,
+    ) = envelopes
     assert error_event["level"] == "error"
     assert error_event["contexts"]["trace"]["op"] == "function.aws"
 
@@ -503,14 +509,13 @@ def test_handler(event, context):
     assert exception["value"] == "Oh?"
     assert exception["mechanism"]["type"] == "aws_lambda"
 
-    (envelope,) = envelopes
-    assert envelope["type"] == "transaction"
-    assert envelope["contexts"]["trace"] == DictionaryContaining(
+    assert transaction_event["type"] == "transaction"
+    assert transaction_event["contexts"]["trace"] == DictionaryContaining(
         error_event["contexts"]["trace"]
     )
-    assert envelope["contexts"]["trace"]["status"] == "internal_error"
-    assert envelope["transaction"] == error_event["transaction"]
-    assert envelope["request"]["url"] == error_event["request"]["url"]
+    assert transaction_event["contexts"]["trace"]["status"] == "internal_error"
+    assert transaction_event["transaction"] == error_event["transaction"]
+    assert transaction_event["request"]["url"] == error_event["request"]["url"]
 
     if has_request_data:
         request_data = {
@@ -525,13 +530,13 @@ def test_handler(event, context):
         request_data = {"url": "awslambda:///{}".format(function_name)}
 
     assert error_event["request"] == request_data
-    assert envelope["request"] == request_data
+    assert transaction_event["request"] == request_data
 
     if batch_size > 1:
         assert error_event["tags"]["batch_size"] == batch_size
         assert error_event["tags"]["batch_request"] is True
-        assert envelope["tags"]["batch_size"] == batch_size
-        assert envelope["tags"]["batch_request"] is True
+        assert transaction_event["tags"]["batch_size"] == batch_size
+        assert transaction_event["tags"]["batch_request"] is True
 
 
 def test_traces_sampler_gets_correct_values_in_sampling_context(

From 5797d2bc7d9a63d5014d5f9a5eb0733bb389560c Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 09:27:47 +0200
Subject: [PATCH 25/62] Switched back to running on real lambda

---
 tests/integrations/aws_lambda/client.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 1c6269834a..949db59f8b 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -6,14 +6,17 @@
 import boto3
 import base64
 
+# export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID=..
+# export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY=...
+# export SENTRY_PYTHON_TEST_AWS_IAM_ROLE="arn:aws:iam::920901907255:role/service-role/lambda"
 
 AWS_REGION_NAME = "us-east-1"
 AWS_ENDPOINT_LOCALSTACK = "http://localhost:4566"
-AWS_LAMBDA_EXECUTION_ROLE_ARN = None
 AWS_FAKE_CREDS_FOR_LOCALSTACK = {
-    "aws_access_key_id": "foobar",
-    "aws_secret_access_key": "foobar",
+    "aws_access_key_id": os.environ["SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"],
+    "aws_secret_access_key": os.environ["SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"],
 }
+AWS_LAMBDA_EXECUTION_ROLE_ARN = os.environ["SENTRY_PYTHON_TEST_AWS_IAM_ROLE"]
 
 
 def get_or_create_lambda_execution_role():
@@ -64,7 +67,7 @@ def get_boto_client():
 
     return boto3.client(
         "lambda",
-        endpoint_url=AWS_ENDPOINT_LOCALSTACK,
+        # endpoint_url=AWS_ENDPOINT_LOCALSTACK,
         region_name=AWS_REGION_NAME,
         **AWS_FAKE_CREDS_FOR_LOCALSTACK,
     )

From 42bf14a666c786e7ea0260509b5747420b2f2a7c Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 09:58:37 +0200
Subject: [PATCH 26/62] Added aws credentials again to run tests against real
 aws

---
 .github/workflows/test-common.yml                             | 3 +++
 .github/workflows/test-integration-aiohttp.yml                | 3 +++
 .github/workflows/test-integration-ariadne.yml                | 3 +++
 .github/workflows/test-integration-arq.yml                    | 3 +++
 .github/workflows/test-integration-asgi.yml                   | 3 +++
 .github/workflows/test-integration-asyncpg.yml                | 3 +++
 .github/workflows/test-integration-aws_lambda.yml             | 3 +++
 .github/workflows/test-integration-beam.yml                   | 3 +++
 .github/workflows/test-integration-boto3.yml                  | 3 +++
 .github/workflows/test-integration-bottle.yml                 | 3 +++
 .github/workflows/test-integration-celery.yml                 | 3 +++
 .github/workflows/test-integration-chalice.yml                | 3 +++
 .github/workflows/test-integration-clickhouse_driver.yml      | 3 +++
 .github/workflows/test-integration-cloud_resource_context.yml | 3 +++
 .github/workflows/test-integration-django.yml                 | 3 +++
 .github/workflows/test-integration-falcon.yml                 | 3 +++
 .github/workflows/test-integration-fastapi.yml                | 3 +++
 .github/workflows/test-integration-flask.yml                  | 3 +++
 .github/workflows/test-integration-gcp.yml                    | 3 +++
 .github/workflows/test-integration-gevent.yml                 | 3 +++
 .github/workflows/test-integration-gql.yml                    | 3 +++
 .github/workflows/test-integration-graphene.yml               | 3 +++
 .github/workflows/test-integration-grpc.yml                   | 3 +++
 .github/workflows/test-integration-httpx.yml                  | 3 +++
 .github/workflows/test-integration-huey.yml                   | 3 +++
 .github/workflows/test-integration-loguru.yml                 | 3 +++
 .github/workflows/test-integration-opentelemetry.yml          | 3 +++
 .github/workflows/test-integration-pure_eval.yml              | 3 +++
 .github/workflows/test-integration-pymongo.yml                | 3 +++
 .github/workflows/test-integration-pyramid.yml                | 3 +++
 .github/workflows/test-integration-quart.yml                  | 3 +++
 .github/workflows/test-integration-redis.yml                  | 3 +++
 .github/workflows/test-integration-rediscluster.yml           | 3 +++
 .github/workflows/test-integration-requests.yml               | 3 +++
 .github/workflows/test-integration-rq.yml                     | 3 +++
 .github/workflows/test-integration-sanic.yml                  | 3 +++
 .github/workflows/test-integration-sqlalchemy.yml             | 3 +++
 .github/workflows/test-integration-starlette.yml              | 3 +++
 .github/workflows/test-integration-starlite.yml               | 3 +++
 .github/workflows/test-integration-strawberry.yml             | 3 +++
 .github/workflows/test-integration-tornado.yml                | 3 +++
 .github/workflows/test-integration-trytond.yml                | 3 +++
 scripts/split-tox-gh-actions/ci-yaml.txt                      | 3 +++
 43 files changed, 129 insertions(+)

diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml
index 03117b7db1..6458340f00 100644
--- a/.github/workflows/test-common.yml
+++ b/.github/workflows/test-common.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml
index f70d652f2e..68c71daac3 100644
--- a/.github/workflows/test-integration-aiohttp.yml
+++ b/.github/workflows/test-integration-aiohttp.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml
index eeb7a0208f..67e9a1a7e3 100644
--- a/.github/workflows/test-integration-ariadne.yml
+++ b/.github/workflows/test-integration-ariadne.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml
index 9a902ab20c..e5bfb68bad 100644
--- a/.github/workflows/test-integration-arq.yml
+++ b/.github/workflows/test-integration-arq.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml
index 1b9e6916ec..40379b7266 100644
--- a/.github/workflows/test-integration-asgi.yml
+++ b/.github/workflows/test-integration-asgi.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml
index de6ad8c9c0..1770489e89 100644
--- a/.github/workflows/test-integration-asyncpg.yml
+++ b/.github/workflows/test-integration-asyncpg.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index f0222796cc..226a3802dd 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml
index a86d6ccd7d..1b958e3857 100644
--- a/.github/workflows/test-integration-beam.yml
+++ b/.github/workflows/test-integration-beam.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml
index fb246c899e..57f8b1e220 100644
--- a/.github/workflows/test-integration-boto3.yml
+++ b/.github/workflows/test-integration-boto3.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml
index 41e496a12b..ab540523d2 100644
--- a/.github/workflows/test-integration-bottle.yml
+++ b/.github/workflows/test-integration-bottle.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml
index 71623f0e1e..f33e3a9974 100644
--- a/.github/workflows/test-integration-celery.yml
+++ b/.github/workflows/test-integration-celery.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml
index 6615aeb75d..a96ea7725c 100644
--- a/.github/workflows/test-integration-chalice.yml
+++ b/.github/workflows/test-integration-chalice.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml
index 49b26e1803..82daed21f5 100644
--- a/.github/workflows/test-integration-clickhouse_driver.yml
+++ b/.github/workflows/test-integration-clickhouse_driver.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml
index c59dca3078..fe11f6d4be 100644
--- a/.github/workflows/test-integration-cloud_resource_context.yml
+++ b/.github/workflows/test-integration-cloud_resource_context.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml
index d667464212..4f69e7b9db 100644
--- a/.github/workflows/test-integration-django.yml
+++ b/.github/workflows/test-integration-django.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml
index 522956c959..899818412d 100644
--- a/.github/workflows/test-integration-falcon.yml
+++ b/.github/workflows/test-integration-falcon.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml
index 87af0054c7..47274b92a7 100644
--- a/.github/workflows/test-integration-fastapi.yml
+++ b/.github/workflows/test-integration-fastapi.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml
index 301256dffc..7a18acebef 100644
--- a/.github/workflows/test-integration-flask.yml
+++ b/.github/workflows/test-integration-flask.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml
index c6eb4adcc8..e0bc78d6a4 100644
--- a/.github/workflows/test-integration-gcp.yml
+++ b/.github/workflows/test-integration-gcp.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml
index d879f5c2f5..eda96fd74c 100644
--- a/.github/workflows/test-integration-gevent.yml
+++ b/.github/workflows/test-integration-gevent.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml
index 9ebd5a16b7..12a10d671e 100644
--- a/.github/workflows/test-integration-gql.yml
+++ b/.github/workflows/test-integration-gql.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml
index 69d89958c3..4e4822fc84 100644
--- a/.github/workflows/test-integration-graphene.yml
+++ b/.github/workflows/test-integration-graphene.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml
index 8c79fae4b8..f45f249daf 100644
--- a/.github/workflows/test-integration-grpc.yml
+++ b/.github/workflows/test-integration-grpc.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml
index 8aadb01812..20362f4b30 100644
--- a/.github/workflows/test-integration-httpx.yml
+++ b/.github/workflows/test-integration-httpx.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml
index a335b9dc9c..cd5739e47c 100644
--- a/.github/workflows/test-integration-huey.yml
+++ b/.github/workflows/test-integration-huey.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml
index f2b6b50317..0f799788e2 100644
--- a/.github/workflows/test-integration-loguru.yml
+++ b/.github/workflows/test-integration-loguru.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml
index 4179d2d22d..4775722ede 100644
--- a/.github/workflows/test-integration-opentelemetry.yml
+++ b/.github/workflows/test-integration-opentelemetry.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml
index c723e02ede..6e566d916e 100644
--- a/.github/workflows/test-integration-pure_eval.yml
+++ b/.github/workflows/test-integration-pure_eval.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml
index ee7e21c425..bd96041416 100644
--- a/.github/workflows/test-integration-pymongo.yml
+++ b/.github/workflows/test-integration-pymongo.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml
index 6ad34e17d0..4b2095b5a7 100644
--- a/.github/workflows/test-integration-pyramid.yml
+++ b/.github/workflows/test-integration-pyramid.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml
index 4c6ccb3157..968edc3e26 100644
--- a/.github/workflows/test-integration-quart.yml
+++ b/.github/workflows/test-integration-quart.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml
index 4af86fde47..52de8c0e10 100644
--- a/.github/workflows/test-integration-redis.yml
+++ b/.github/workflows/test-integration-redis.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml
index 73ed5c1733..de7841c9c7 100644
--- a/.github/workflows/test-integration-rediscluster.yml
+++ b/.github/workflows/test-integration-rediscluster.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml
index 2645b13305..34b67e113f 100644
--- a/.github/workflows/test-integration-requests.yml
+++ b/.github/workflows/test-integration-requests.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml
index 6aec4ac632..f634f7764c 100644
--- a/.github/workflows/test-integration-rq.yml
+++ b/.github/workflows/test-integration-rq.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml
index 27ca05eb6a..c3193c12c3 100644
--- a/.github/workflows/test-integration-sanic.yml
+++ b/.github/workflows/test-integration-sanic.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml
index a45ede7a2f..9b25033d64 100644
--- a/.github/workflows/test-integration-sqlalchemy.yml
+++ b/.github/workflows/test-integration-sqlalchemy.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml
index e19578b95c..2d4ad92613 100644
--- a/.github/workflows/test-integration-starlette.yml
+++ b/.github/workflows/test-integration-starlette.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml
index 01715e1c66..b0b33bf4c1 100644
--- a/.github/workflows/test-integration-starlite.yml
+++ b/.github/workflows/test-integration-starlite.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml
index b0e30a8f5b..b3b8e92dcb 100644
--- a/.github/workflows/test-integration-strawberry.yml
+++ b/.github/workflows/test-integration-strawberry.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml
index ac4700db4a..e75fd2cf63 100644
--- a/.github/workflows/test-integration-tornado.yml
+++ b/.github/workflows/test-integration-tornado.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml
index 130ed096f7..5f76786e18 100644
--- a/.github/workflows/test-integration-trytond.yml
+++ b/.github/workflows/test-integration-trytond.yml
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/scripts/split-tox-gh-actions/ci-yaml.txt b/scripts/split-tox-gh-actions/ci-yaml.txt
index 99d8154c60..5e49c0f4c6 100644
--- a/scripts/split-tox-gh-actions/ci-yaml.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml.txt
@@ -21,6 +21,9 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
 {{ test }}

From 3120d05b65806af5292a1a9371c2562b96fcd20c Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 11:22:31 +0200
Subject: [PATCH 27/62] Made sure one test runs correct in real AWS lambda

---
 tests/integrations/aws_lambda/client.py   | 18 +++++-------------
 tests/integrations/aws_lambda/test_aws.py |  4 +++-
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 949db59f8b..16be90900e 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -6,25 +6,19 @@
 import boto3
 import base64
 
-# export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID=..
-# export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY=...
-# export SENTRY_PYTHON_TEST_AWS_IAM_ROLE="arn:aws:iam::920901907255:role/service-role/lambda"
-
 AWS_REGION_NAME = "us-east-1"
-AWS_ENDPOINT_LOCALSTACK = "http://localhost:4566"
-AWS_FAKE_CREDS_FOR_LOCALSTACK = {
+AWS_CREDENTIALS = {
     "aws_access_key_id": os.environ["SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"],
     "aws_secret_access_key": os.environ["SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"],
 }
-AWS_LAMBDA_EXECUTION_ROLE_ARN = os.environ["SENTRY_PYTHON_TEST_AWS_IAM_ROLE"]
+AWS_LAMBDA_EXECUTION_ROLE_ARN = None
 
 
 def get_or_create_lambda_execution_role():
     global AWS_LAMBDA_EXECUTION_ROLE_ARN
 
     role_name = "lambda-ex"
-    policy = """
-    {
+    policy = """{
         "Version": "2012-10-17",
         "Statement": [
             {
@@ -39,9 +33,8 @@ def get_or_create_lambda_execution_role():
     """
     iam_client = boto3.client(
         "iam",
-        endpoint_url=AWS_ENDPOINT_LOCALSTACK,
         region_name=AWS_REGION_NAME,
-        **AWS_FAKE_CREDS_FOR_LOCALSTACK,
+        **AWS_CREDENTIALS,
     )
 
     try:
@@ -67,9 +60,8 @@ def get_boto_client():
 
     return boto3.client(
         "lambda",
-        # endpoint_url=AWS_ENDPOINT_LOCALSTACK,
         region_name=AWS_REGION_NAME,
-        **AWS_FAKE_CREDS_FOR_LOCALSTACK,
+        **AWS_CREDENTIALS,
     )
 
 
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 7f3afa4d2e..633261974c 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -104,10 +104,12 @@ def envelope_processor(envelope):
 class TestTransport(HttpTransport):
     def _send_event(self, event):
         event = event_processor(event)
+        print("x")  # force AWS lambda logging to start a new line (when printing a stacktrace it swallows the \n from the next print statement)
         print("\\nEVENT: {}\\n".format(json.dumps(event)))
 
     def _send_envelope(self, envelope):
         envelope = envelope_processor(envelope)
+        print("x")  # force AWS lambda logging to start a new line (when printing a stacktrace it swallows the \n from the next print statement)
         print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
 
 def init_sdk(timeout_warning=False, **extra_init_args):
@@ -320,7 +322,7 @@ def test_init_error(run_lambda_function, lambda_runtime):
     )
 
     (event,) = events
-    assert "name 'func' is not defined" in event
+    assert event["exception"]["values"][0]["value"] == "name 'func' is not defined"
 
 
 def test_timeout_error(run_lambda_function):

From 58963af3c12ec131b6d3f33d36f67d7caedf4024 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 11:32:39 +0200
Subject: [PATCH 28/62] Cleanup

---
 tests/integrations/aws_lambda/client.py   | 8 ++++----
 tests/integrations/aws_lambda/test_aws.py | 6 ++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 16be90900e..21f0cb5b0c 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -11,13 +11,13 @@
     "aws_access_key_id": os.environ["SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"],
     "aws_secret_access_key": os.environ["SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"],
 }
+AWS_LAMBDA_EXECUTION_ROLE_NAME = "lambda-ex"
 AWS_LAMBDA_EXECUTION_ROLE_ARN = None
 
 
 def get_or_create_lambda_execution_role():
     global AWS_LAMBDA_EXECUTION_ROLE_ARN
 
-    role_name = "lambda-ex"
     policy = """{
         "Version": "2012-10-17",
         "Statement": [
@@ -38,19 +38,19 @@ def get_or_create_lambda_execution_role():
     )
 
     try:
-        response = iam_client.get_role(RoleName=role_name)
+        response = iam_client.get_role(RoleName=AWS_LAMBDA_EXECUTION_ROLE_NAME)
         AWS_LAMBDA_EXECUTION_ROLE_ARN = response["Role"]["Arn"]
     except iam_client.exceptions.NoSuchEntityException:
         # create role for lambda execution
         response = iam_client.create_role(
-            RoleName=role_name,
+            RoleName=AWS_LAMBDA_EXECUTION_ROLE_NAME,
             AssumeRolePolicyDocument=policy,
         )
         AWS_LAMBDA_EXECUTION_ROLE_ARN = response["Role"]["Arn"]
 
         # attach policy to role
         iam_client.attach_role_policy(
-            RoleName=role_name,
+            RoleName=AWS_LAMBDA_EXECUTION_ROLE_NAME,
             PolicyArn="arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
         )
 
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 633261974c..3e0d1b820d 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -104,12 +104,14 @@ def envelope_processor(envelope):
 class TestTransport(HttpTransport):
     def _send_event(self, event):
         event = event_processor(event)
-        print("x")  # force AWS lambda logging to start a new line (when printing a stacktrace it swallows the \n from the next print statement)
+        print("x")  # force AWS lambda logging to start a new line
+                    # (when printing a stacktrace it swallows the \\n from the next print statement)
         print("\\nEVENT: {}\\n".format(json.dumps(event)))
 
     def _send_envelope(self, envelope):
         envelope = envelope_processor(envelope)
-        print("x")  # force AWS lambda logging to start a new line (when printing a stacktrace it swallows the \n from the next print statement)
+        print("x")  # force AWS lambda logging to start a new line
+                    # (when printing a stacktrace it swallows the \\n from the next print statement)
         print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
 
 def init_sdk(timeout_warning=False, **extra_init_args):

From 815c2e0fa469773448a1f5ba253b369f753e6bd2 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 13:57:28 +0200
Subject: [PATCH 29/62] Cleanup

---
 .github/workflows/test-common.yml                |  3 ---
 .github/workflows/test-integration-aiohttp.yml   |  3 ---
 .github/workflows/test-integration-ariadne.yml   |  3 ---
 .github/workflows/test-integration-arq.yml       |  3 ---
 .github/workflows/test-integration-asgi.yml      |  3 ---
 .github/workflows/test-integration-asyncpg.yml   |  3 ---
 .../workflows/test-integration-aws_lambda.yml    | 16 +++-------------
 .github/workflows/test-integration-beam.yml      |  3 ---
 .github/workflows/test-integration-boto3.yml     |  3 ---
 .github/workflows/test-integration-bottle.yml    |  3 ---
 .github/workflows/test-integration-celery.yml    |  3 ---
 .github/workflows/test-integration-chalice.yml   |  3 ---
 .../test-integration-clickhouse_driver.yml       |  3 ---
 .../test-integration-cloud_resource_context.yml  |  3 ---
 .github/workflows/test-integration-django.yml    |  3 ---
 .github/workflows/test-integration-falcon.yml    |  3 ---
 .github/workflows/test-integration-fastapi.yml   |  3 ---
 .github/workflows/test-integration-flask.yml     |  3 ---
 .github/workflows/test-integration-gcp.yml       |  3 ---
 .github/workflows/test-integration-gevent.yml    |  3 ---
 .github/workflows/test-integration-gql.yml       |  3 ---
 .github/workflows/test-integration-graphene.yml  |  3 ---
 .github/workflows/test-integration-grpc.yml      |  3 ---
 .github/workflows/test-integration-httpx.yml     |  3 ---
 .github/workflows/test-integration-huey.yml      |  3 ---
 .github/workflows/test-integration-loguru.yml    |  3 ---
 .../workflows/test-integration-opentelemetry.yml |  3 ---
 .github/workflows/test-integration-pure_eval.yml |  3 ---
 .github/workflows/test-integration-pymongo.yml   |  3 ---
 .github/workflows/test-integration-pyramid.yml   |  3 ---
 .github/workflows/test-integration-quart.yml     |  3 ---
 .github/workflows/test-integration-redis.yml     |  3 ---
 .../workflows/test-integration-rediscluster.yml  |  3 ---
 .github/workflows/test-integration-requests.yml  |  3 ---
 .github/workflows/test-integration-rq.yml        |  3 ---
 .github/workflows/test-integration-sanic.yml     |  3 ---
 .../workflows/test-integration-sqlalchemy.yml    |  3 ---
 .github/workflows/test-integration-starlette.yml |  3 ---
 .github/workflows/test-integration-starlite.yml  |  3 ---
 .../workflows/test-integration-strawberry.yml    |  3 ---
 .github/workflows/test-integration-tornado.yml   |  3 ---
 .github/workflows/test-integration-trytond.yml   |  3 ---
 .../ci-yaml-aws-credentials.txt                  |  3 +++
 .../ci-yaml-setup-localstack.txt                 | 10 ----------
 .../ci-yaml-test-snippet.txt                     |  1 -
 scripts/split-tox-gh-actions/ci-yaml.txt         |  4 +---
 .../split-tox-gh-actions/split-tox-gh-actions.py |  6 +++---
 tests/integrations/aws_lambda/client.py          |  9 +++++++++
 tests/integrations/aws_lambda/test_aws.py        | 15 +++++----------
 49 files changed, 24 insertions(+), 163 deletions(-)
 create mode 100644 scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt
 delete mode 100644 scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt

diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml
index 6458340f00..03117b7db1 100644
--- a/.github/workflows/test-common.yml
+++ b/.github/workflows/test-common.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml
index 68c71daac3..f70d652f2e 100644
--- a/.github/workflows/test-integration-aiohttp.yml
+++ b/.github/workflows/test-integration-aiohttp.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml
index 67e9a1a7e3..eeb7a0208f 100644
--- a/.github/workflows/test-integration-ariadne.yml
+++ b/.github/workflows/test-integration-ariadne.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml
index e5bfb68bad..9a902ab20c 100644
--- a/.github/workflows/test-integration-arq.yml
+++ b/.github/workflows/test-integration-arq.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml
index 40379b7266..1b9e6916ec 100644
--- a/.github/workflows/test-integration-asgi.yml
+++ b/.github/workflows/test-integration-asgi.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml
index 1770489e89..de6ad8c9c0 100644
--- a/.github/workflows/test-integration-asyncpg.yml
+++ b/.github/workflows/test-integration-asyncpg.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index 226a3802dd..8a3652b4df 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -18,12 +18,12 @@ permissions:
   contents: read
 
 env:
-  BUILD_CACHE_KEY: ${{ github.sha }}
-  CACHED_BUILD_PATHS: |
-    ${{ github.workspace }}/dist-serverless
   SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
   SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
   SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
+  BUILD_CACHE_KEY: ${{ github.sha }}
+  CACHED_BUILD_PATHS: |
+    ${{ github.workspace }}/dist-serverless
 
 jobs:
   test:
@@ -50,16 +50,6 @@ jobs:
       - name: Setup Test Env
         run: |
           pip install coverage "tox>=3,<4"
-          pip install localstack awscli-local[ver1] # install LocalStack cli
-          docker pull localstack/localstack         # Make sure to pull the latest version of the image
-          localstack start -d                       # Start LocalStack in the background
-
-          echo "Waiting for LocalStack startup..."  # Wait 30 seconds for the LocalStack container
-          localstack wait -t 30                     # to become ready before timing out
-          echo "Startup complete"
-
-          awslocal lambda list-functions
-          echo "done listing functions"
 
       - name: Test aws_lambda
         uses: nick-fields/retry@v2
diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml
index 1b958e3857..a86d6ccd7d 100644
--- a/.github/workflows/test-integration-beam.yml
+++ b/.github/workflows/test-integration-beam.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml
index 57f8b1e220..fb246c899e 100644
--- a/.github/workflows/test-integration-boto3.yml
+++ b/.github/workflows/test-integration-boto3.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml
index ab540523d2..41e496a12b 100644
--- a/.github/workflows/test-integration-bottle.yml
+++ b/.github/workflows/test-integration-bottle.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml
index f33e3a9974..71623f0e1e 100644
--- a/.github/workflows/test-integration-celery.yml
+++ b/.github/workflows/test-integration-celery.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml
index a96ea7725c..6615aeb75d 100644
--- a/.github/workflows/test-integration-chalice.yml
+++ b/.github/workflows/test-integration-chalice.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml
index 82daed21f5..49b26e1803 100644
--- a/.github/workflows/test-integration-clickhouse_driver.yml
+++ b/.github/workflows/test-integration-clickhouse_driver.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml
index fe11f6d4be..c59dca3078 100644
--- a/.github/workflows/test-integration-cloud_resource_context.yml
+++ b/.github/workflows/test-integration-cloud_resource_context.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml
index 4f69e7b9db..d667464212 100644
--- a/.github/workflows/test-integration-django.yml
+++ b/.github/workflows/test-integration-django.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml
index 899818412d..522956c959 100644
--- a/.github/workflows/test-integration-falcon.yml
+++ b/.github/workflows/test-integration-falcon.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml
index 47274b92a7..87af0054c7 100644
--- a/.github/workflows/test-integration-fastapi.yml
+++ b/.github/workflows/test-integration-fastapi.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml
index 7a18acebef..301256dffc 100644
--- a/.github/workflows/test-integration-flask.yml
+++ b/.github/workflows/test-integration-flask.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml
index e0bc78d6a4..c6eb4adcc8 100644
--- a/.github/workflows/test-integration-gcp.yml
+++ b/.github/workflows/test-integration-gcp.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml
index eda96fd74c..d879f5c2f5 100644
--- a/.github/workflows/test-integration-gevent.yml
+++ b/.github/workflows/test-integration-gevent.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml
index 12a10d671e..9ebd5a16b7 100644
--- a/.github/workflows/test-integration-gql.yml
+++ b/.github/workflows/test-integration-gql.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml
index 4e4822fc84..69d89958c3 100644
--- a/.github/workflows/test-integration-graphene.yml
+++ b/.github/workflows/test-integration-graphene.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml
index f45f249daf..8c79fae4b8 100644
--- a/.github/workflows/test-integration-grpc.yml
+++ b/.github/workflows/test-integration-grpc.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml
index 20362f4b30..8aadb01812 100644
--- a/.github/workflows/test-integration-httpx.yml
+++ b/.github/workflows/test-integration-httpx.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml
index cd5739e47c..a335b9dc9c 100644
--- a/.github/workflows/test-integration-huey.yml
+++ b/.github/workflows/test-integration-huey.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml
index 0f799788e2..f2b6b50317 100644
--- a/.github/workflows/test-integration-loguru.yml
+++ b/.github/workflows/test-integration-loguru.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml
index 4775722ede..4179d2d22d 100644
--- a/.github/workflows/test-integration-opentelemetry.yml
+++ b/.github/workflows/test-integration-opentelemetry.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml
index 6e566d916e..c723e02ede 100644
--- a/.github/workflows/test-integration-pure_eval.yml
+++ b/.github/workflows/test-integration-pure_eval.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml
index bd96041416..ee7e21c425 100644
--- a/.github/workflows/test-integration-pymongo.yml
+++ b/.github/workflows/test-integration-pymongo.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml
index 4b2095b5a7..6ad34e17d0 100644
--- a/.github/workflows/test-integration-pyramid.yml
+++ b/.github/workflows/test-integration-pyramid.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml
index 968edc3e26..4c6ccb3157 100644
--- a/.github/workflows/test-integration-quart.yml
+++ b/.github/workflows/test-integration-quart.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml
index 52de8c0e10..4af86fde47 100644
--- a/.github/workflows/test-integration-redis.yml
+++ b/.github/workflows/test-integration-redis.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml
index de7841c9c7..73ed5c1733 100644
--- a/.github/workflows/test-integration-rediscluster.yml
+++ b/.github/workflows/test-integration-rediscluster.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml
index 34b67e113f..2645b13305 100644
--- a/.github/workflows/test-integration-requests.yml
+++ b/.github/workflows/test-integration-requests.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml
index f634f7764c..6aec4ac632 100644
--- a/.github/workflows/test-integration-rq.yml
+++ b/.github/workflows/test-integration-rq.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml
index c3193c12c3..27ca05eb6a 100644
--- a/.github/workflows/test-integration-sanic.yml
+++ b/.github/workflows/test-integration-sanic.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml
index 9b25033d64..a45ede7a2f 100644
--- a/.github/workflows/test-integration-sqlalchemy.yml
+++ b/.github/workflows/test-integration-sqlalchemy.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml
index 2d4ad92613..e19578b95c 100644
--- a/.github/workflows/test-integration-starlette.yml
+++ b/.github/workflows/test-integration-starlette.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml
index b0b33bf4c1..01715e1c66 100644
--- a/.github/workflows/test-integration-starlite.yml
+++ b/.github/workflows/test-integration-starlite.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml
index b3b8e92dcb..b0e30a8f5b 100644
--- a/.github/workflows/test-integration-strawberry.yml
+++ b/.github/workflows/test-integration-strawberry.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml
index e75fd2cf63..ac4700db4a 100644
--- a/.github/workflows/test-integration-tornado.yml
+++ b/.github/workflows/test-integration-tornado.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml
index 5f76786e18..130ed096f7 100644
--- a/.github/workflows/test-integration-trytond.yml
+++ b/.github/workflows/test-integration-trytond.yml
@@ -21,9 +21,6 @@ env:
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
   test:
diff --git a/scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt b/scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt
new file mode 100644
index 0000000000..cb61a12f5c
--- /dev/null
+++ b/scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt
@@ -0,0 +1,3 @@
+  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
diff --git a/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt b/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt
deleted file mode 100644
index 0cbdc54f87..0000000000
--- a/scripts/split-tox-gh-actions/ci-yaml-setup-localstack.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-          pip install localstack awscli-local[ver1] # install LocalStack cli
-          docker pull localstack/localstack         # Make sure to pull the latest version of the image
-          localstack start -d                       # Start LocalStack in the background
-
-          echo "Waiting for LocalStack startup..."  # Wait 30 seconds for the LocalStack container
-          localstack wait -t 30                     # to become ready before timing out
-          echo "Startup complete"
-
-          awslocal lambda list-functions
-          echo "done listing functions"
diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
index d998e74ab8..c2d10596ea 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
@@ -16,7 +16,6 @@
         run: |
           pip install coverage "tox>=3,<4"
           {{ setup_postgres }}
-          {{ setup_localstack }}
 
       - name: Test {{ framework }}
         uses: nick-fields/retry@v2
diff --git a/scripts/split-tox-gh-actions/ci-yaml.txt b/scripts/split-tox-gh-actions/ci-yaml.txt
index 5e49c0f4c6..90bd5c61ce 100644
--- a/scripts/split-tox-gh-actions/ci-yaml.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml.txt
@@ -18,12 +18,10 @@ permissions:
   contents: read
 
 env:
+{{ aws_credentials }}
   BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
-  SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
 
 jobs:
 {{ test }}
diff --git a/scripts/split-tox-gh-actions/split-tox-gh-actions.py b/scripts/split-tox-gh-actions/split-tox-gh-actions.py
index a9180e2beb..ea187475db 100755
--- a/scripts/split-tox-gh-actions/split-tox-gh-actions.py
+++ b/scripts/split-tox-gh-actions/split-tox-gh-actions.py
@@ -28,7 +28,7 @@
 TEMPLATE_FILE = TEMPLATE_DIR / "ci-yaml.txt"
 TEMPLATE_FILE_SERVICES = TEMPLATE_DIR / "ci-yaml-services.txt"
 TEMPLATE_FILE_SETUP_DB = TEMPLATE_DIR / "ci-yaml-setup-db.txt"
-TEMPLATE_FILE_SETUP_LOCALSTACK = TEMPLATE_DIR / "ci-yaml-setup-localstack.txt"
+TEMPLATE_FILE_AWS_CREDENTIALS = TEMPLATE_DIR / "ci-yaml-aws-credentials.txt"
 TEMPLATE_SNIPPET_TEST = TEMPLATE_DIR / "ci-yaml-test-snippet.txt"
 TEMPLATE_SNIPPET_TEST_PY27 = TEMPLATE_DIR / "ci-yaml-test-py27-snippet.txt"
 
@@ -133,9 +133,9 @@ def write_yaml_file(
                 f = open(TEMPLATE_FILE_SETUP_DB, "r")
                 out += "".join(f.readlines())
 
-        elif template_line.strip() == "{{ setup_localstack }}":
+        elif template_line.strip() == "{{ aws_credentials }}":
             if current_framework in FRAMEWORKS_NEEDING_AWS:
-                f = open(TEMPLATE_FILE_SETUP_LOCALSTACK, "r")
+                f = open(TEMPLATE_FILE_AWS_CREDENTIALS, "r")
                 out += "".join(f.readlines())
 
         elif template_line.strip() == "{{ additional_uses }}":
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 21f0cb5b0c..d23e00da59 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -137,6 +137,15 @@ def run_lambda_function(
     if dir_already_existing:
         print("Lambda function directory already exists, skipping creation")
 
+    # if dir not existing
+    # create function directory
+    # syntax check
+    # if layer
+    # add layer to dir
+    # publish_layer_version
+    # create function (and swallow "already existing" error)
+    # invoke function
+
     if not dir_already_existing:
         tmpdir = tempfile.mkdtemp(prefix="%s-" % fn_name)
 
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 3e0d1b820d..729c83aabf 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -1,16 +1,11 @@
 """
 # AWS Lambda system tests
 
-This testsuite uses boto3 to upload actual Lambda functions to a locally running
-localstack instance. (Localstack is a fully functional local AWS stack. See https://localstack.cloud/)
-
-Run localstack on your machine:
-    docker run \
-        --rm -it \
-        -p 4566:4566 \
-        -p 4510-4559:4510-4559 \
-        -v "/var/run/docker.sock:/var/run/docker.sock" \
-        localstack/localstack
+This testsuite uses boto3 to upload actual Lambda functions to AWS Lambda.
+
+For running test locally you need to set these env vars (You can find the values in the Sentry password manager):
+export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID="..."
+export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY="..."
 
 If you need to debug a new runtime, use this REPL to figure things out:
 

From 20d94b624f16121d62afcddf2f41592bad82f607 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 14:31:17 +0200
Subject: [PATCH 30/62] print env for debugging

---
 scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
index c2d10596ea..6e5644ab6b 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
@@ -28,6 +28,8 @@
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&

From 708c046ccab107642a0efe6de4130ec28aced6b4 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 14:35:44 +0200
Subject: [PATCH 31/62] ,

---
 .github/workflows/test-common.yml                             | 2 ++
 .github/workflows/test-integration-aiohttp.yml                | 2 ++
 .github/workflows/test-integration-ariadne.yml                | 2 ++
 .github/workflows/test-integration-arq.yml                    | 2 ++
 .github/workflows/test-integration-asgi.yml                   | 2 ++
 .github/workflows/test-integration-asyncpg.yml                | 2 ++
 .github/workflows/test-integration-aws_lambda.yml             | 2 ++
 .github/workflows/test-integration-beam.yml                   | 2 ++
 .github/workflows/test-integration-boto3.yml                  | 2 ++
 .github/workflows/test-integration-bottle.yml                 | 2 ++
 .github/workflows/test-integration-celery.yml                 | 2 ++
 .github/workflows/test-integration-chalice.yml                | 2 ++
 .github/workflows/test-integration-clickhouse_driver.yml      | 2 ++
 .github/workflows/test-integration-cloud_resource_context.yml | 2 ++
 .github/workflows/test-integration-django.yml                 | 2 ++
 .github/workflows/test-integration-falcon.yml                 | 2 ++
 .github/workflows/test-integration-fastapi.yml                | 2 ++
 .github/workflows/test-integration-flask.yml                  | 2 ++
 .github/workflows/test-integration-gcp.yml                    | 2 ++
 .github/workflows/test-integration-gevent.yml                 | 2 ++
 .github/workflows/test-integration-gql.yml                    | 2 ++
 .github/workflows/test-integration-graphene.yml               | 2 ++
 .github/workflows/test-integration-grpc.yml                   | 2 ++
 .github/workflows/test-integration-httpx.yml                  | 2 ++
 .github/workflows/test-integration-huey.yml                   | 2 ++
 .github/workflows/test-integration-loguru.yml                 | 2 ++
 .github/workflows/test-integration-opentelemetry.yml          | 2 ++
 .github/workflows/test-integration-pure_eval.yml              | 2 ++
 .github/workflows/test-integration-pymongo.yml                | 2 ++
 .github/workflows/test-integration-pyramid.yml                | 2 ++
 .github/workflows/test-integration-quart.yml                  | 2 ++
 .github/workflows/test-integration-redis.yml                  | 2 ++
 .github/workflows/test-integration-rediscluster.yml           | 2 ++
 .github/workflows/test-integration-requests.yml               | 2 ++
 .github/workflows/test-integration-rq.yml                     | 2 ++
 .github/workflows/test-integration-sanic.yml                  | 2 ++
 .github/workflows/test-integration-sqlalchemy.yml             | 2 ++
 .github/workflows/test-integration-starlette.yml              | 2 ++
 .github/workflows/test-integration-starlite.yml               | 2 ++
 .github/workflows/test-integration-strawberry.yml             | 2 ++
 .github/workflows/test-integration-tornado.yml                | 2 ++
 .github/workflows/test-integration-trytond.yml                | 2 ++
 42 files changed, 84 insertions(+)

diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml
index 03117b7db1..6a0160b4bf 100644
--- a/.github/workflows/test-common.yml
+++ b/.github/workflows/test-common.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml
index f70d652f2e..9082740649 100644
--- a/.github/workflows/test-integration-aiohttp.yml
+++ b/.github/workflows/test-integration-aiohttp.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml
index eeb7a0208f..fc08435ce3 100644
--- a/.github/workflows/test-integration-ariadne.yml
+++ b/.github/workflows/test-integration-ariadne.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-ariadne" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml
index 9a902ab20c..f255c6ae1d 100644
--- a/.github/workflows/test-integration-arq.yml
+++ b/.github/workflows/test-integration-arq.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-arq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml
index 1b9e6916ec..4c87c02f75 100644
--- a/.github/workflows/test-integration-asgi.yml
+++ b/.github/workflows/test-integration-asgi.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml
index de6ad8c9c0..6a75697f15 100644
--- a/.github/workflows/test-integration-asyncpg.yml
+++ b/.github/workflows/test-integration-asyncpg.yml
@@ -80,6 +80,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asyncpg" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index 8a3652b4df..1dae8d53b7 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -62,6 +62,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml
index a86d6ccd7d..4adbb8999d 100644
--- a/.github/workflows/test-integration-beam.yml
+++ b/.github/workflows/test-integration-beam.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml
index fb246c899e..33fef180b1 100644
--- a/.github/workflows/test-integration-boto3.yml
+++ b/.github/workflows/test-integration-boto3.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml
index 41e496a12b..2cbc6500a9 100644
--- a/.github/workflows/test-integration-bottle.yml
+++ b/.github/workflows/test-integration-bottle.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml
index 71623f0e1e..1205ae7bf1 100644
--- a/.github/workflows/test-integration-celery.yml
+++ b/.github/workflows/test-integration-celery.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml
index 6615aeb75d..153baa6444 100644
--- a/.github/workflows/test-integration-chalice.yml
+++ b/.github/workflows/test-integration-chalice.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml
index 49b26e1803..57190cfb7c 100644
--- a/.github/workflows/test-integration-clickhouse_driver.yml
+++ b/.github/workflows/test-integration-clickhouse_driver.yml
@@ -61,6 +61,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-clickhouse_driver" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml
index c59dca3078..bbb6934b49 100644
--- a/.github/workflows/test-integration-cloud_resource_context.yml
+++ b/.github/workflows/test-integration-cloud_resource_context.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-cloud_resource_context" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml
index d667464212..e223f6471d 100644
--- a/.github/workflows/test-integration-django.yml
+++ b/.github/workflows/test-integration-django.yml
@@ -80,6 +80,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml
index 522956c959..079ccd803e 100644
--- a/.github/workflows/test-integration-falcon.yml
+++ b/.github/workflows/test-integration-falcon.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml
index 87af0054c7..8a8e7c0e1c 100644
--- a/.github/workflows/test-integration-fastapi.yml
+++ b/.github/workflows/test-integration-fastapi.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml
index 301256dffc..4f5e0989e7 100644
--- a/.github/workflows/test-integration-flask.yml
+++ b/.github/workflows/test-integration-flask.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml
index c6eb4adcc8..5d7345f470 100644
--- a/.github/workflows/test-integration-gcp.yml
+++ b/.github/workflows/test-integration-gcp.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml
index d879f5c2f5..a3275d1d2a 100644
--- a/.github/workflows/test-integration-gevent.yml
+++ b/.github/workflows/test-integration-gevent.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml
index 9ebd5a16b7..b96091393e 100644
--- a/.github/workflows/test-integration-gql.yml
+++ b/.github/workflows/test-integration-gql.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gql" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml
index 69d89958c3..ef6585176b 100644
--- a/.github/workflows/test-integration-graphene.yml
+++ b/.github/workflows/test-integration-graphene.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-graphene" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml
index 8c79fae4b8..7e4554dd9e 100644
--- a/.github/workflows/test-integration-grpc.yml
+++ b/.github/workflows/test-integration-grpc.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-grpc" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml
index 8aadb01812..d3b3fa3d5c 100644
--- a/.github/workflows/test-integration-httpx.yml
+++ b/.github/workflows/test-integration-httpx.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml
index a335b9dc9c..f6ef6fb16c 100644
--- a/.github/workflows/test-integration-huey.yml
+++ b/.github/workflows/test-integration-huey.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml
index f2b6b50317..5763d4f14f 100644
--- a/.github/workflows/test-integration-loguru.yml
+++ b/.github/workflows/test-integration-loguru.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-loguru" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml
index 4179d2d22d..8619833566 100644
--- a/.github/workflows/test-integration-opentelemetry.yml
+++ b/.github/workflows/test-integration-opentelemetry.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-opentelemetry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml
index c723e02ede..370c2031b9 100644
--- a/.github/workflows/test-integration-pure_eval.yml
+++ b/.github/workflows/test-integration-pure_eval.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pure_eval" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml
index ee7e21c425..334fd78fe0 100644
--- a/.github/workflows/test-integration-pymongo.yml
+++ b/.github/workflows/test-integration-pymongo.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml
index 6ad34e17d0..a2d5c2e94d 100644
--- a/.github/workflows/test-integration-pyramid.yml
+++ b/.github/workflows/test-integration-pyramid.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml
index 4c6ccb3157..629d748d8f 100644
--- a/.github/workflows/test-integration-quart.yml
+++ b/.github/workflows/test-integration-quart.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml
index 4af86fde47..0774bb43ba 100644
--- a/.github/workflows/test-integration-redis.yml
+++ b/.github/workflows/test-integration-redis.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml
index 73ed5c1733..de2f0700cd 100644
--- a/.github/workflows/test-integration-rediscluster.yml
+++ b/.github/workflows/test-integration-rediscluster.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml
index 2645b13305..baea679a14 100644
--- a/.github/workflows/test-integration-requests.yml
+++ b/.github/workflows/test-integration-requests.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml
index 6aec4ac632..9e827c54fa 100644
--- a/.github/workflows/test-integration-rq.yml
+++ b/.github/workflows/test-integration-rq.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml
index 27ca05eb6a..e12b453474 100644
--- a/.github/workflows/test-integration-sanic.yml
+++ b/.github/workflows/test-integration-sanic.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml
index a45ede7a2f..7c8a6faaed 100644
--- a/.github/workflows/test-integration-sqlalchemy.yml
+++ b/.github/workflows/test-integration-sqlalchemy.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml
index e19578b95c..af89c5e2fe 100644
--- a/.github/workflows/test-integration-starlette.yml
+++ b/.github/workflows/test-integration-starlette.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml
index 01715e1c66..6dcd46a186 100644
--- a/.github/workflows/test-integration-starlite.yml
+++ b/.github/workflows/test-integration-starlite.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlite" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml
index b0e30a8f5b..956dcb4e2d 100644
--- a/.github/workflows/test-integration-strawberry.yml
+++ b/.github/workflows/test-integration-strawberry.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml
index ac4700db4a..de75538511 100644
--- a/.github/workflows/test-integration-tornado.yml
+++ b/.github/workflows/test-integration-tornado.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml
index 130ed096f7..e2fbbd1f65 100644
--- a/.github/workflows/test-integration-trytond.yml
+++ b/.github/workflows/test-integration-trytond.yml
@@ -59,6 +59,8 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
+            printenv
+
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-trytond" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&

From 4f30bbd3ad4c7906f47f5422eb799a989de0b3ae Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 14:53:27 +0200
Subject: [PATCH 32/62] cleanup

---
 .github/workflows/test-common.yml                           | 2 --
 .github/workflows/test-integration-aiohttp.yml              | 2 --
 .github/workflows/test-integration-ariadne.yml              | 2 --
 .github/workflows/test-integration-arq.yml                  | 2 --
 .github/workflows/test-integration-asgi.yml                 | 2 --
 .github/workflows/test-integration-asyncpg.yml              | 2 --
 .github/workflows/test-integration-aws_lambda.yml           | 6 +-----
 .github/workflows/test-integration-beam.yml                 | 2 --
 .github/workflows/test-integration-boto3.yml                | 2 --
 .github/workflows/test-integration-bottle.yml               | 2 --
 .github/workflows/test-integration-celery.yml               | 2 --
 .github/workflows/test-integration-chalice.yml              | 2 --
 .github/workflows/test-integration-clickhouse_driver.yml    | 2 --
 .../workflows/test-integration-cloud_resource_context.yml   | 2 --
 .github/workflows/test-integration-django.yml               | 2 --
 .github/workflows/test-integration-falcon.yml               | 2 --
 .github/workflows/test-integration-fastapi.yml              | 2 --
 .github/workflows/test-integration-flask.yml                | 2 --
 .github/workflows/test-integration-gcp.yml                  | 2 --
 .github/workflows/test-integration-gevent.yml               | 2 --
 .github/workflows/test-integration-gql.yml                  | 2 --
 .github/workflows/test-integration-graphene.yml             | 2 --
 .github/workflows/test-integration-grpc.yml                 | 2 --
 .github/workflows/test-integration-httpx.yml                | 2 --
 .github/workflows/test-integration-huey.yml                 | 2 --
 .github/workflows/test-integration-loguru.yml               | 2 --
 .github/workflows/test-integration-opentelemetry.yml        | 2 --
 .github/workflows/test-integration-pure_eval.yml            | 2 --
 .github/workflows/test-integration-pymongo.yml              | 2 --
 .github/workflows/test-integration-pyramid.yml              | 2 --
 .github/workflows/test-integration-quart.yml                | 2 --
 .github/workflows/test-integration-redis.yml                | 2 --
 .github/workflows/test-integration-rediscluster.yml         | 2 --
 .github/workflows/test-integration-requests.yml             | 2 --
 .github/workflows/test-integration-rq.yml                   | 2 --
 .github/workflows/test-integration-sanic.yml                | 2 --
 .github/workflows/test-integration-sqlalchemy.yml           | 2 --
 .github/workflows/test-integration-starlette.yml            | 2 --
 .github/workflows/test-integration-starlite.yml             | 2 --
 .github/workflows/test-integration-strawberry.yml           | 2 --
 .github/workflows/test-integration-tornado.yml              | 2 --
 .github/workflows/test-integration-trytond.yml              | 2 --
 scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt    | 1 -
 scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt       | 2 --
 44 files changed, 1 insertion(+), 90 deletions(-)

diff --git a/.github/workflows/test-common.yml b/.github/workflows/test-common.yml
index 6a0160b4bf..03117b7db1 100644
--- a/.github/workflows/test-common.yml
+++ b/.github/workflows/test-common.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-common" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-aiohttp.yml b/.github/workflows/test-integration-aiohttp.yml
index 9082740649..f70d652f2e 100644
--- a/.github/workflows/test-integration-aiohttp.yml
+++ b/.github/workflows/test-integration-aiohttp.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aiohttp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-ariadne.yml b/.github/workflows/test-integration-ariadne.yml
index fc08435ce3..eeb7a0208f 100644
--- a/.github/workflows/test-integration-ariadne.yml
+++ b/.github/workflows/test-integration-ariadne.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-ariadne" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-arq.yml b/.github/workflows/test-integration-arq.yml
index f255c6ae1d..9a902ab20c 100644
--- a/.github/workflows/test-integration-arq.yml
+++ b/.github/workflows/test-integration-arq.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-arq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-asgi.yml b/.github/workflows/test-integration-asgi.yml
index 4c87c02f75..1b9e6916ec 100644
--- a/.github/workflows/test-integration-asgi.yml
+++ b/.github/workflows/test-integration-asgi.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asgi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-asyncpg.yml b/.github/workflows/test-integration-asyncpg.yml
index 6a75697f15..de6ad8c9c0 100644
--- a/.github/workflows/test-integration-asyncpg.yml
+++ b/.github/workflows/test-integration-asyncpg.yml
@@ -80,8 +80,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-asyncpg" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index 1dae8d53b7..e22f43102e 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -19,9 +19,7 @@ permissions:
 
 env:
   SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
-  BUILD_CACHE_KEY: ${{ github.sha }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}  BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
 
@@ -62,8 +60,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-aws_lambda" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-beam.yml b/.github/workflows/test-integration-beam.yml
index 4adbb8999d..a86d6ccd7d 100644
--- a/.github/workflows/test-integration-beam.yml
+++ b/.github/workflows/test-integration-beam.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-beam" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-boto3.yml b/.github/workflows/test-integration-boto3.yml
index 33fef180b1..fb246c899e 100644
--- a/.github/workflows/test-integration-boto3.yml
+++ b/.github/workflows/test-integration-boto3.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-boto3" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-bottle.yml b/.github/workflows/test-integration-bottle.yml
index 2cbc6500a9..41e496a12b 100644
--- a/.github/workflows/test-integration-bottle.yml
+++ b/.github/workflows/test-integration-bottle.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-bottle" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-celery.yml b/.github/workflows/test-integration-celery.yml
index 1205ae7bf1..71623f0e1e 100644
--- a/.github/workflows/test-integration-celery.yml
+++ b/.github/workflows/test-integration-celery.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-celery" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-chalice.yml b/.github/workflows/test-integration-chalice.yml
index 153baa6444..6615aeb75d 100644
--- a/.github/workflows/test-integration-chalice.yml
+++ b/.github/workflows/test-integration-chalice.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-chalice" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-clickhouse_driver.yml b/.github/workflows/test-integration-clickhouse_driver.yml
index 57190cfb7c..49b26e1803 100644
--- a/.github/workflows/test-integration-clickhouse_driver.yml
+++ b/.github/workflows/test-integration-clickhouse_driver.yml
@@ -61,8 +61,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-clickhouse_driver" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-cloud_resource_context.yml b/.github/workflows/test-integration-cloud_resource_context.yml
index bbb6934b49..c59dca3078 100644
--- a/.github/workflows/test-integration-cloud_resource_context.yml
+++ b/.github/workflows/test-integration-cloud_resource_context.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-cloud_resource_context" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-django.yml b/.github/workflows/test-integration-django.yml
index e223f6471d..d667464212 100644
--- a/.github/workflows/test-integration-django.yml
+++ b/.github/workflows/test-integration-django.yml
@@ -80,8 +80,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-django" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-falcon.yml b/.github/workflows/test-integration-falcon.yml
index 079ccd803e..522956c959 100644
--- a/.github/workflows/test-integration-falcon.yml
+++ b/.github/workflows/test-integration-falcon.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-falcon" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-fastapi.yml b/.github/workflows/test-integration-fastapi.yml
index 8a8e7c0e1c..87af0054c7 100644
--- a/.github/workflows/test-integration-fastapi.yml
+++ b/.github/workflows/test-integration-fastapi.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-fastapi" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-flask.yml b/.github/workflows/test-integration-flask.yml
index 4f5e0989e7..301256dffc 100644
--- a/.github/workflows/test-integration-flask.yml
+++ b/.github/workflows/test-integration-flask.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-flask" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-gcp.yml b/.github/workflows/test-integration-gcp.yml
index 5d7345f470..c6eb4adcc8 100644
--- a/.github/workflows/test-integration-gcp.yml
+++ b/.github/workflows/test-integration-gcp.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gcp" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-gevent.yml b/.github/workflows/test-integration-gevent.yml
index a3275d1d2a..d879f5c2f5 100644
--- a/.github/workflows/test-integration-gevent.yml
+++ b/.github/workflows/test-integration-gevent.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gevent" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-gql.yml b/.github/workflows/test-integration-gql.yml
index b96091393e..9ebd5a16b7 100644
--- a/.github/workflows/test-integration-gql.yml
+++ b/.github/workflows/test-integration-gql.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-gql" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-graphene.yml b/.github/workflows/test-integration-graphene.yml
index ef6585176b..69d89958c3 100644
--- a/.github/workflows/test-integration-graphene.yml
+++ b/.github/workflows/test-integration-graphene.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-graphene" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-grpc.yml b/.github/workflows/test-integration-grpc.yml
index 7e4554dd9e..8c79fae4b8 100644
--- a/.github/workflows/test-integration-grpc.yml
+++ b/.github/workflows/test-integration-grpc.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-grpc" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-httpx.yml b/.github/workflows/test-integration-httpx.yml
index d3b3fa3d5c..8aadb01812 100644
--- a/.github/workflows/test-integration-httpx.yml
+++ b/.github/workflows/test-integration-httpx.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-httpx" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-huey.yml b/.github/workflows/test-integration-huey.yml
index f6ef6fb16c..a335b9dc9c 100644
--- a/.github/workflows/test-integration-huey.yml
+++ b/.github/workflows/test-integration-huey.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-huey" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-loguru.yml b/.github/workflows/test-integration-loguru.yml
index 5763d4f14f..f2b6b50317 100644
--- a/.github/workflows/test-integration-loguru.yml
+++ b/.github/workflows/test-integration-loguru.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-loguru" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-opentelemetry.yml b/.github/workflows/test-integration-opentelemetry.yml
index 8619833566..4179d2d22d 100644
--- a/.github/workflows/test-integration-opentelemetry.yml
+++ b/.github/workflows/test-integration-opentelemetry.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-opentelemetry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-pure_eval.yml b/.github/workflows/test-integration-pure_eval.yml
index 370c2031b9..c723e02ede 100644
--- a/.github/workflows/test-integration-pure_eval.yml
+++ b/.github/workflows/test-integration-pure_eval.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pure_eval" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-pymongo.yml b/.github/workflows/test-integration-pymongo.yml
index 334fd78fe0..ee7e21c425 100644
--- a/.github/workflows/test-integration-pymongo.yml
+++ b/.github/workflows/test-integration-pymongo.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pymongo" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-pyramid.yml b/.github/workflows/test-integration-pyramid.yml
index a2d5c2e94d..6ad34e17d0 100644
--- a/.github/workflows/test-integration-pyramid.yml
+++ b/.github/workflows/test-integration-pyramid.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-pyramid" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-quart.yml b/.github/workflows/test-integration-quart.yml
index 629d748d8f..4c6ccb3157 100644
--- a/.github/workflows/test-integration-quart.yml
+++ b/.github/workflows/test-integration-quart.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-quart" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-redis.yml b/.github/workflows/test-integration-redis.yml
index 0774bb43ba..4af86fde47 100644
--- a/.github/workflows/test-integration-redis.yml
+++ b/.github/workflows/test-integration-redis.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-redis" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-rediscluster.yml b/.github/workflows/test-integration-rediscluster.yml
index de2f0700cd..73ed5c1733 100644
--- a/.github/workflows/test-integration-rediscluster.yml
+++ b/.github/workflows/test-integration-rediscluster.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rediscluster" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-requests.yml b/.github/workflows/test-integration-requests.yml
index baea679a14..2645b13305 100644
--- a/.github/workflows/test-integration-requests.yml
+++ b/.github/workflows/test-integration-requests.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-requests" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-rq.yml b/.github/workflows/test-integration-rq.yml
index 9e827c54fa..6aec4ac632 100644
--- a/.github/workflows/test-integration-rq.yml
+++ b/.github/workflows/test-integration-rq.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-rq" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-sanic.yml b/.github/workflows/test-integration-sanic.yml
index e12b453474..27ca05eb6a 100644
--- a/.github/workflows/test-integration-sanic.yml
+++ b/.github/workflows/test-integration-sanic.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sanic" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-sqlalchemy.yml b/.github/workflows/test-integration-sqlalchemy.yml
index 7c8a6faaed..a45ede7a2f 100644
--- a/.github/workflows/test-integration-sqlalchemy.yml
+++ b/.github/workflows/test-integration-sqlalchemy.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-sqlalchemy" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-starlette.yml b/.github/workflows/test-integration-starlette.yml
index af89c5e2fe..e19578b95c 100644
--- a/.github/workflows/test-integration-starlette.yml
+++ b/.github/workflows/test-integration-starlette.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlette" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-starlite.yml b/.github/workflows/test-integration-starlite.yml
index 6dcd46a186..01715e1c66 100644
--- a/.github/workflows/test-integration-starlite.yml
+++ b/.github/workflows/test-integration-starlite.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-starlite" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-strawberry.yml b/.github/workflows/test-integration-strawberry.yml
index 956dcb4e2d..b0e30a8f5b 100644
--- a/.github/workflows/test-integration-strawberry.yml
+++ b/.github/workflows/test-integration-strawberry.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-strawberry" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-tornado.yml b/.github/workflows/test-integration-tornado.yml
index de75538511..ac4700db4a 100644
--- a/.github/workflows/test-integration-tornado.yml
+++ b/.github/workflows/test-integration-tornado.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-tornado" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/.github/workflows/test-integration-trytond.yml b/.github/workflows/test-integration-trytond.yml
index e2fbbd1f65..130ed096f7 100644
--- a/.github/workflows/test-integration-trytond.yml
+++ b/.github/workflows/test-integration-trytond.yml
@@ -59,8 +59,6 @@ jobs:
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-trytond" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&
diff --git a/scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt b/scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt
index cb61a12f5c..fe4b4104e0 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-aws-credentials.txt
@@ -1,3 +1,2 @@
   SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
   SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
-  SENTRY_PYTHON_TEST_AWS_IAM_ROLE: ${{ secrets.SENTRY_PYTHON_TEST_AWS_IAM_ROLE }}
diff --git a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
index 6e5644ab6b..c2d10596ea 100644
--- a/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
+++ b/scripts/split-tox-gh-actions/ci-yaml-test-snippet.txt
@@ -28,8 +28,6 @@
             set -x # print commands that are executed
             coverage erase
 
-            printenv
-
             # Run tests
             ./scripts/runtox.sh "py${{ matrix.python-version }}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch &&
             coverage combine .coverage* &&

From 44ae142672687d8cfe3381225abe365b4508a78c Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 14:56:40 +0200
Subject: [PATCH 33/62] Cleanup

---
 tests/integrations/aws_lambda/client.py | 3 ---
 tox.ini                                 | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index d23e00da59..b2e44f3697 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -248,9 +248,6 @@ def clean_up():
         Payload=payload,
     )
 
-    assert (
-        response is not None
-    ), "Failed to create Lambda function in time (max retries exceeded)"
     assert 200 <= response["StatusCode"] < 300, response
     return response
 
diff --git a/tox.ini b/tox.ini
index f182e14ee8..2e9b54d3e4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -569,6 +569,8 @@ setenv =
 
     COVERAGE_FILE=.coverage-{envname}
 passenv =
+    SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID
+    SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY
     SENTRY_PYTHON_TEST_POSTGRES_USER
     SENTRY_PYTHON_TEST_POSTGRES_PASSWORD
     SENTRY_PYTHON_TEST_POSTGRES_NAME

From 22e0917a893e78b3eef690f116cb25d24b3f657b Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 16:51:45 +0200
Subject: [PATCH 34/62] Made tests with layers work

---
 scripts/build_aws_lambda_layer.py         |   2 -
 tests/integrations/aws_lambda/client.py   | 164 +++++++++++-----------
 tests/integrations/aws_lambda/test_aws.py |   1 +
 3 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/scripts/build_aws_lambda_layer.py b/scripts/build_aws_lambda_layer.py
index 64f1e8105f..4d4703273c 100644
--- a/scripts/build_aws_lambda_layer.py
+++ b/scripts/build_aws_lambda_layer.py
@@ -105,8 +105,6 @@ def build_packaged_zip(dest_abs_path=None, make_dist=False, out_zip_filename=Non
     layer_builder.create_init_serverless_sdk_package()
     layer_builder.zip()
 
-    shutil.rmtree(dest_abs_path)
-
 
 if __name__ == "__main__":
     build_packaged_zip()
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index b2e44f3697..57698ea17b 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -1,6 +1,5 @@
 import sys
 import os
-import shutil
 import tempfile
 import subprocess
 import boto3
@@ -65,47 +64,6 @@ def get_boto_client():
     )
 
 
-def build_no_code_serverless_function_and_layer(
-    client, tmpdir, fn_name, runtime, timeout, initial_handler
-):
-    """
-    Util function that auto instruments the no code implementation of the python
-    sdk by creating a layer containing the Python-sdk, and then creating a func
-    that uses that layer
-    """
-    from scripts.build_aws_lambda_layer import build_packaged_zip
-
-    build_packaged_zip(
-        dest_abs_path=tmpdir, make_dist=True, out_zip_filename="serverless-ball.zip"
-    )
-
-    with open(os.path.join(tmpdir, "serverless-ball.zip"), "rb") as serverless_zip:
-        response = client.publish_layer_version(
-            LayerName="python-serverless-sdk-test",
-            Description="Created as part of testsuite for getsentry/sentry-python",
-            Content={"ZipFile": serverless_zip.read()},
-        )
-
-    with open(os.path.join(tmpdir, "ball.zip"), "rb") as zip:
-        client.create_function(
-            FunctionName=fn_name,
-            Runtime=runtime,
-            Timeout=timeout,
-            Environment={
-                "Variables": {
-                    "SENTRY_INITIAL_HANDLER": initial_handler,
-                    "SENTRY_DSN": "https://123abc@example.com/123",
-                    "SENTRY_TRACES_SAMPLE_RATE": "1.0",
-                }
-            },
-            Role=AWS_LAMBDA_EXECUTION_ROLE_ARN,
-            Handler="sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler",
-            Layers=[response["LayerVersionArn"]],
-            Code={"ZipFile": zip.read()},
-            Description="Created as part of testsuite for getsentry/sentry-python",
-        )
-
-
 def run_lambda_function(
     client,
     runtime,
@@ -126,29 +84,18 @@ def run_lambda_function(
     """
     subprocess_kwargs = dict(subprocess_kwargs)
 
-    dir_prefix = str(hash(code))
-    fn_name = "test_function_{}".format(dir_prefix)
+    function_hash = str(hash(code)).replace("-", "_")
+    fn_name = "test_function_{}".format(function_hash)
 
     tmp_base_dir = tempfile.gettempdir()
-    dir_already_existing = any(
-        [x.startswith(fn_name) for x in os.listdir(tmp_base_dir)]
-    )
+    tmpdir = os.path.join(tmp_base_dir, fn_name)
+    dir_already_existing = os.path.isdir(tmpdir)
 
     if dir_already_existing:
         print("Lambda function directory already exists, skipping creation")
 
-    # if dir not existing
-    # create function directory
-    # syntax check
-    # if layer
-    # add layer to dir
-    # publish_layer_version
-    # create function (and swallow "already existing" error)
-    # invoke function
-
     if not dir_already_existing:
-        tmpdir = tempfile.mkdtemp(prefix="%s-" % fn_name)
-
+        os.mkdir(tmpdir)
         if initial_handler:
             # If Initial handler value is provided i.e. it is not the default
             # `test_lambda.test_handler`, then create another dir level so that our path is
@@ -174,6 +121,7 @@ def run_lambda_function(
             subprocess.check_call([sys.executable, test_lambda_py])
 
         if layer is None:
+            # Install dependencies into Lambda function package
             setup_cfg = os.path.join(tmpdir, "setup.cfg")
             with open(setup_cfg, "w") as f:
                 f.write("[install]\nprefix=")
@@ -182,14 +130,12 @@ def run_lambda_function(
                 [sys.executable, "setup.py", "sdist", "-d", os.path.join(tmpdir, "..")],
                 **subprocess_kwargs,
             )
-
             subprocess.check_call(
                 "pip install mock==3.0.0 funcsigs -t .",
                 cwd=tmpdir,
                 shell=True,
                 **subprocess_kwargs,
             )
-
             # https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
             subprocess.check_call(
                 "pip install ../*.tar.gz -t .",
@@ -198,32 +144,44 @@ def run_lambda_function(
                 **subprocess_kwargs,
             )
 
-            shutil.make_archive(os.path.join(tmpdir, "ball"), "zip", tmpdir)
-
-            with open(os.path.join(tmpdir, "ball.zip"), "rb") as zip:
-                client.create_function(
-                    FunctionName=fn_name,
-                    Runtime=runtime,
-                    Timeout=timeout,
-                    Role=AWS_LAMBDA_EXECUTION_ROLE_ARN,
-                    Handler="test_lambda.test_handler",
-                    Code={"ZipFile": zip.read()},
-                    Description="Created as part of testsuite for getsentry/sentry-python",
-                )
+            # Create Lambda function zip package
+            subprocess.run(
+                [
+                    "zip",
+                    "-q",
+                    "-x",
+                    "**/__pycache__/*",
+                    "-r",
+                    "lambda-function-package.zip",
+                    "./",
+                ],
+                cwd=tmpdir,
+                check=True,
+            )
 
         else:
+            # Create Lambda function zip package
             subprocess.run(
-                ["zip", "-q", "-x", "**/__pycache__/*", "-r", "ball.zip", "./"],
+                [
+                    "zip",
+                    "-q",
+                    "-x",
+                    "**/__pycache__/*",
+                    "-r",
+                    "lambda-function-package.zip",
+                    "./",
+                ],
                 cwd=tmpdir,
                 check=True,
             )
 
-            # Default initial handler
-            if not initial_handler:
-                initial_handler = "test_lambda.test_handler"
+            # Create Lambda layer zip package
+            from scripts.build_aws_lambda_layer import build_packaged_zip
 
-            build_no_code_serverless_function_and_layer(
-                client, tmpdir, fn_name, runtime, timeout, initial_handler
+            build_packaged_zip(
+                dest_abs_path=tmpdir,
+                make_dist=True,
+                out_zip_filename="lambda-layer-package.zip",
             )
 
         @add_finalizer
@@ -238,11 +196,55 @@ def clean_up():
             for manager in managers:
                 manager.clear()
 
-        waiter = client.get_waiter("function_active_v2")
-        waiter.wait(FunctionName=fn_name)
+    layers = []
+    environment = {}
+    handler = initial_handler or "test_lambda.test_handler"
+
+    if layer is not None:
+        with open(
+            os.path.join(tmpdir, "lambda-layer-package.zip"), "rb"
+        ) as lambda_layer_zip:
+            response = client.publish_layer_version(
+                LayerName="python-serverless-sdk-test",
+                Description="Created as part of testsuite for getsentry/sentry-python",
+                Content={"ZipFile": lambda_layer_zip.read()},
+            )
+
+        layers = [response["LayerVersionArn"]]
+        handler = "sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler"
+        environment = {
+            "Variables": {
+                "SENTRY_INITIAL_HANDLER": initial_handler or "test_lambda.test_handler",
+                "SENTRY_DSN": "https://123abc@example.com/123",
+                "SENTRY_TRACES_SAMPLE_RATE": "1.0",
+            }
+        }
+
+    full_fn_name = fn_name + runtime.replace(".", "")
+    try:
+        with open(
+            os.path.join(tmpdir, "lambda-function-package.zip"), "rb"
+        ) as lambda_function_zip:
+            client.create_function(
+                Description="Created as part of testsuite for getsentry/sentry-python",
+                FunctionName=full_fn_name,
+                Runtime=runtime,
+                Timeout=timeout,
+                Role=AWS_LAMBDA_EXECUTION_ROLE_ARN,
+                Handler=handler,
+                Code={"ZipFile": lambda_function_zip.read()},
+                Environment=environment,
+                Layers=layers,
+            )
+
+            waiter = client.get_waiter("function_active_v2")
+            waiter.wait(FunctionName=full_fn_name)
+    except client.exceptions.ResourceConflictException:
+        # Ignore if function is already existing
+        pass
 
     response = client.invoke(
-        FunctionName=fn_name,
+        FunctionName=full_fn_name,
         InvocationType="RequestResponse",
         LogType="Tail",
         Payload=payload,
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 729c83aabf..e37d10f795 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -115,6 +115,7 @@ def init_sdk(timeout_warning=False, **extra_init_args):
         transport=TestTransport,
         integrations=[AwsLambdaIntegration(timeout_warning=timeout_warning)],
         shutdown_timeout=10,
+        debug=True,
         **extra_init_args
     )
 """

From 4a093141318ef982824bb348efd6a137332a0454 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 16:52:27 +0200
Subject: [PATCH 35/62] Cleanup

---
 tests/integrations/aws_lambda/test_aws.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index e37d10f795..729c83aabf 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -115,7 +115,6 @@ def init_sdk(timeout_warning=False, **extra_init_args):
         transport=TestTransport,
         integrations=[AwsLambdaIntegration(timeout_warning=timeout_warning)],
         shutdown_timeout=10,
-        debug=True,
         **extra_init_args
     )
 """

From 5a59681a4099c7b5660eb2a83f2e4cb4205fb782 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 16:53:26 +0200
Subject: [PATCH 36/62] Cleanup

---
 .github/workflows/test-integration-aws_lambda.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/test-integration-aws_lambda.yml b/.github/workflows/test-integration-aws_lambda.yml
index e22f43102e..385bb4b13a 100644
--- a/.github/workflows/test-integration-aws_lambda.yml
+++ b/.github/workflows/test-integration-aws_lambda.yml
@@ -19,7 +19,8 @@ permissions:
 
 env:
   SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID: ${{ secrets.SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID }}
-  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}  BUILD_CACHE_KEY: ${{ github.sha }}
+  SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY: ${{ secrets.SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY }}
+  BUILD_CACHE_KEY: ${{ github.sha }}
   CACHED_BUILD_PATHS: |
     ${{ github.workspace }}/dist-serverless
 

From b2e265f01d1ed792cde4e648cb9c5a76f1456e2e Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 23 Oct 2023 17:32:18 +0200
Subject: [PATCH 37/62] Cleanup

---
 tests/integrations/aws_lambda/client.py | 200 ++++++++++++------------
 1 file changed, 104 insertions(+), 96 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 57698ea17b..898e3e9bc9 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -14,7 +14,100 @@
 AWS_LAMBDA_EXECUTION_ROLE_ARN = None
 
 
-def get_or_create_lambda_execution_role():
+def _install_depencencies(base_dir, subprocess_kwargs):
+    """
+    Installs dependencies for AWS Lambda function
+    """
+    setup_cfg = os.path.join(base_dir, "setup.cfg")
+    with open(setup_cfg, "w") as f:
+        f.write("[install]\nprefix=")
+
+    subprocess.check_call(
+        [sys.executable, "setup.py", "sdist", "-d", os.path.join(base_dir, "..")],
+        **subprocess_kwargs,
+    )
+    subprocess.check_call(
+        "pip install mock==3.0.0 funcsigs -t .",
+        cwd=base_dir,
+        shell=True,
+        **subprocess_kwargs,
+    )
+    # https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
+    subprocess.check_call(
+        "pip install ../*.tar.gz -t .",
+        cwd=base_dir,
+        shell=True,
+        **subprocess_kwargs,
+    )
+
+
+def _create_lambda_function_zip(base_dir):
+    """
+    Zips the given base_dir omitting Python cache files
+    """
+    subprocess.run(
+        [
+            "zip",
+            "-q",
+            "-x",
+            "**/__pycache__/*",
+            "-r",
+            "lambda-function-package.zip",
+            "./",
+        ],
+        cwd=base_dir,
+        check=True,
+    )
+
+
+def _create_lambda_package(
+    base_dir, code, initial_handler, layer, syntax_check, subprocess_kwargs
+):
+    """
+    Creates deployable packages (as zip files) for AWS Lambda function and layer
+    """
+    if initial_handler:
+        # If Initial handler value is provided i.e. it is not the default
+        # `test_lambda.test_handler`, then create another dir level so that our path is
+        # test_dir.test_lambda.test_handler
+        test_dir_path = os.path.join(base_dir, "test_dir")
+        python_init_file = os.path.join(test_dir_path, "__init__.py")
+        os.makedirs(test_dir_path)
+        with open(python_init_file, "w"):
+            # Create __init__ file to make it a python package
+            pass
+
+        test_lambda_py = os.path.join(base_dir, "test_dir", "test_lambda.py")
+    else:
+        test_lambda_py = os.path.join(base_dir, "test_lambda.py")
+
+    with open(test_lambda_py, "w") as f:
+        f.write(code)
+
+    if syntax_check:
+        # Check file for valid syntax first, and that the integration does not
+        # crash when not running in Lambda (but rather a local deployment tool
+        # such as chalice's)
+        subprocess.check_call([sys.executable, test_lambda_py])
+
+    if layer is None:
+        _install_depencencies(base_dir, subprocess_kwargs)
+        _create_lambda_function_zip(base_dir)
+
+    else:
+        _create_lambda_function_zip(base_dir)
+
+        # Create Lambda layer zip package
+        from scripts.build_aws_lambda_layer import build_packaged_zip
+
+        build_packaged_zip(
+            dest_abs_path=base_dir,
+            make_dist=True,
+            out_zip_filename="lambda-layer-package.zip",
+        )
+
+
+def _get_or_create_lambda_execution_role():
     global AWS_LAMBDA_EXECUTION_ROLE_ARN
 
     policy = """{
@@ -55,7 +148,7 @@ def get_or_create_lambda_execution_role():
 
 
 def get_boto_client():
-    get_or_create_lambda_execution_role()
+    _get_or_create_lambda_execution_role()
 
     return boto3.client(
         "lambda",
@@ -88,101 +181,17 @@ def run_lambda_function(
     fn_name = "test_function_{}".format(function_hash)
 
     tmp_base_dir = tempfile.gettempdir()
-    tmpdir = os.path.join(tmp_base_dir, fn_name)
-    dir_already_existing = os.path.isdir(tmpdir)
+    base_dir = os.path.join(tmp_base_dir, fn_name)
+    dir_already_existing = os.path.isdir(base_dir)
 
     if dir_already_existing:
         print("Lambda function directory already exists, skipping creation")
 
     if not dir_already_existing:
-        os.mkdir(tmpdir)
-        if initial_handler:
-            # If Initial handler value is provided i.e. it is not the default
-            # `test_lambda.test_handler`, then create another dir level so that our path is
-            # test_dir.test_lambda.test_handler
-            test_dir_path = os.path.join(tmpdir, "test_dir")
-            python_init_file = os.path.join(test_dir_path, "__init__.py")
-            os.makedirs(test_dir_path)
-            with open(python_init_file, "w"):
-                # Create __init__ file to make it a python package
-                pass
-
-            test_lambda_py = os.path.join(tmpdir, "test_dir", "test_lambda.py")
-        else:
-            test_lambda_py = os.path.join(tmpdir, "test_lambda.py")
-
-        with open(test_lambda_py, "w") as f:
-            f.write(code)
-
-        if syntax_check:
-            # Check file for valid syntax first, and that the integration does not
-            # crash when not running in Lambda (but rather a local deployment tool
-            # such as chalice's)
-            subprocess.check_call([sys.executable, test_lambda_py])
-
-        if layer is None:
-            # Install dependencies into Lambda function package
-            setup_cfg = os.path.join(tmpdir, "setup.cfg")
-            with open(setup_cfg, "w") as f:
-                f.write("[install]\nprefix=")
-
-            subprocess.check_call(
-                [sys.executable, "setup.py", "sdist", "-d", os.path.join(tmpdir, "..")],
-                **subprocess_kwargs,
-            )
-            subprocess.check_call(
-                "pip install mock==3.0.0 funcsigs -t .",
-                cwd=tmpdir,
-                shell=True,
-                **subprocess_kwargs,
-            )
-            # https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
-            subprocess.check_call(
-                "pip install ../*.tar.gz -t .",
-                cwd=tmpdir,
-                shell=True,
-                **subprocess_kwargs,
-            )
-
-            # Create Lambda function zip package
-            subprocess.run(
-                [
-                    "zip",
-                    "-q",
-                    "-x",
-                    "**/__pycache__/*",
-                    "-r",
-                    "lambda-function-package.zip",
-                    "./",
-                ],
-                cwd=tmpdir,
-                check=True,
-            )
-
-        else:
-            # Create Lambda function zip package
-            subprocess.run(
-                [
-                    "zip",
-                    "-q",
-                    "-x",
-                    "**/__pycache__/*",
-                    "-r",
-                    "lambda-function-package.zip",
-                    "./",
-                ],
-                cwd=tmpdir,
-                check=True,
-            )
-
-            # Create Lambda layer zip package
-            from scripts.build_aws_lambda_layer import build_packaged_zip
-
-            build_packaged_zip(
-                dest_abs_path=tmpdir,
-                make_dist=True,
-                out_zip_filename="lambda-layer-package.zip",
-            )
+        os.mkdir(base_dir)
+        _create_lambda_package(
+            base_dir, code, initial_handler, layer, syntax_check, subprocess_kwargs
+        )
 
         @add_finalizer
         def clean_up():
@@ -202,7 +211,7 @@ def clean_up():
 
     if layer is not None:
         with open(
-            os.path.join(tmpdir, "lambda-layer-package.zip"), "rb"
+            os.path.join(base_dir, "lambda-layer-package.zip"), "rb"
         ) as lambda_layer_zip:
             response = client.publish_layer_version(
                 LayerName="python-serverless-sdk-test",
@@ -223,7 +232,7 @@ def clean_up():
     full_fn_name = fn_name + runtime.replace(".", "")
     try:
         with open(
-            os.path.join(tmpdir, "lambda-function-package.zip"), "rb"
+            os.path.join(base_dir, "lambda-function-package.zip"), "rb"
         ) as lambda_function_zip:
             client.create_function(
                 Description="Created as part of testsuite for getsentry/sentry-python",
@@ -240,8 +249,7 @@ def clean_up():
             waiter = client.get_waiter("function_active_v2")
             waiter.wait(FunctionName=full_fn_name)
     except client.exceptions.ResourceConflictException:
-        # Ignore if function is already existing
-        pass
+        print("Lambda function already exists, this is fine, we will just invoke it.")
 
     response = client.invoke(
         FunctionName=full_fn_name,

From 2341ba588ad4dc0bff35e8bb2b366aa92d1ba8ca Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 10:29:04 +0200
Subject: [PATCH 38/62] Fixed some tests

---
 tests/integrations/aws_lambda/test_aws.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 729c83aabf..9234fc8687 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -752,6 +752,14 @@ def test_error_has_existing_trace_context_performance_enabled(run_lambda_functio
     parent_sampled = 1
     sentry_trace_header = "{}-{}-{}".format(trace_id, parent_span_id, parent_sampled)
 
+    # We simulate here AWS Api Gateway's behavior of passing HTTP headers
+    # as the `headers` dict in the event passed to the Lambda function.
+    payload = {
+        "headers": {
+            "sentry-trace": sentry_trace_header,
+        }
+    }
+
     envelopes, events, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
@@ -763,7 +771,7 @@ def test_handler(event, context):
             raise Exception("Oh!")
         """
         ),
-        payload=b'{"sentry_trace": "%s"}' % sentry_trace_header.encode(),
+        payload=json.dumps(payload).encode(),
     )
 
     (msg_event, error_event, transaction_event) = envelopes
@@ -791,6 +799,14 @@ def test_error_has_existing_trace_context_performance_disabled(run_lambda_functi
     parent_sampled = 1
     sentry_trace_header = "{}-{}-{}".format(trace_id, parent_span_id, parent_sampled)
 
+    # We simulate here AWS Api Gateway's behavior of passing HTTP headers
+    # as the `headers` dict in the event passed to the Lambda function.
+    payload = {
+        "headers": {
+            "sentry-trace": sentry_trace_header,
+        }
+    }
+
     envelopes, events, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
@@ -802,7 +818,7 @@ def test_handler(event, context):
             raise Exception("Oh!")
         """
         ),
-        payload=b'{"sentry_trace": "%s"}' % sentry_trace_header.encode(),
+        payload=json.dumps(payload).encode(),
     )
 
     (msg_event, error_event) = events

From bad5abcec481c11182001b20f146bcd2e254a06f Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 10:49:22 +0200
Subject: [PATCH 39/62] Cleanup

---
 tests/integrations/aws_lambda/test_aws.py | 28 +++++++++++------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 9234fc8687..3491e8ae70 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -182,7 +182,7 @@ def inner(
 
 
 def test_basic(run_lambda_function):
-    envelopes, events, response = run_lambda_function(
+    _, events, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -233,7 +233,7 @@ def test_initialization_order(run_lambda_function):
     as seen by AWS already runs. At this point at least draining the queue
     should work."""
 
-    envelopes, events, _response = run_lambda_function(
+    _, events, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -254,7 +254,7 @@ def test_handler(event, context):
 
 
 def test_request_data(run_lambda_function):
-    envelopes, events, _response = run_lambda_function(
+    _, events, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -306,7 +306,7 @@ def test_handler(event, context):
 
 
 def test_init_error(run_lambda_function, lambda_runtime):
-    envelopes, events, response = run_lambda_function(
+    _, events, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -323,7 +323,7 @@ def test_init_error(run_lambda_function, lambda_runtime):
 
 
 def test_timeout_error(run_lambda_function):
-    envelopes, events, response = run_lambda_function(
+    _, events, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -366,7 +366,7 @@ def test_handler(event, context):
 
 
 def test_performance_no_error(run_lambda_function):
-    envelopes, events, response = run_lambda_function(
+    envelopes, _, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -388,7 +388,7 @@ def test_handler(event, context):
 
 
 def test_performance_error(run_lambda_function):
-    envelopes, events, response = run_lambda_function(
+    envelopes, _, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -477,7 +477,7 @@ def test_non_dict_event(
     batch_size,
     DictionaryContaining,  # noqa:N803
 ):
-    envelopes, events, response = run_lambda_function(
+    envelopes, _, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -572,7 +572,7 @@ def test_traces_sampler_gets_correct_values_in_sampling_context(
 
     import inspect
 
-    envelopes, events, response = run_lambda_function(
+    _, _, response = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(inspect.getsource(StringContaining))
         + dedent(inspect.getsource(DictionaryContaining))
@@ -652,7 +652,7 @@ def test_serverless_no_code_instrumentation(run_lambda_function):
         "test_dir.test_lambda.test_handler",
     ]:
         print("Testing Initial Handler ", initial_handler)
-        envelopes, events, response = run_lambda_function(
+        _, _, response = run_lambda_function(
             dedent(
                 """
             import sentry_sdk
@@ -685,7 +685,7 @@ def test_handler(event, context):
 
 
 def test_error_has_new_trace_context_performance_enabled(run_lambda_function):
-    envelopes, events, response = run_lambda_function(
+    envelopes, _, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -718,7 +718,7 @@ def test_handler(event, context):
 
 
 def test_error_has_new_trace_context_performance_disabled(run_lambda_function):
-    envelopes, events, response = run_lambda_function(
+    _, events, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -760,7 +760,7 @@ def test_error_has_existing_trace_context_performance_enabled(run_lambda_functio
         }
     }
 
-    envelopes, events, response = run_lambda_function(
+    envelopes, _, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """
@@ -807,7 +807,7 @@ def test_error_has_existing_trace_context_performance_disabled(run_lambda_functi
         }
     }
 
-    envelopes, events, response = run_lambda_function(
+    _, events, _ = run_lambda_function(
         LAMBDA_PRELUDE
         + dedent(
             """

From 24b87b466aa626067471c2a9d718a13e55722f8c Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 11:06:09 +0200
Subject: [PATCH 40/62] Some comments to clarify things

---
 tests/integrations/aws_lambda/test_aws.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 3491e8ae70..a9030880ae 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -1,13 +1,15 @@
 """
 # AWS Lambda system tests
 
-This testsuite uses boto3 to upload actual Lambda functions to AWS Lambda.
+This testsuite uses boto3 to upload actual Lambda functions to AWS Lambda and invoke them.
 
 For running test locally you need to set these env vars (You can find the values in the Sentry password manager):
 export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID="..."
 export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY="..."
 
-If you need to debug a new runtime, use this REPL to figure things out:
+
+If you need to debug a new runtime, use this REPL to run arbitrary Python or bash commands
+in that runtime in a Lambda function: (see the bottom of client.py for more information.)
 
     pip3 install click
     python3 tests/integrations/aws_lambda/client.py --runtime=python4.0

From 0e252bd6c6ebe49c085bb1ce9a4d5eec71e7404d Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 11:44:36 +0200
Subject: [PATCH 41/62] Updated aws-cleanup.sh script to only delete functions
 created by the test suite

---
 scripts/aws-cleanup.sh                    | 16 ++++++++++++++++
 tests/integrations/aws_lambda/test_aws.py |  3 +++
 2 files changed, 19 insertions(+)
 create mode 100755 scripts/aws-cleanup.sh

diff --git a/scripts/aws-cleanup.sh b/scripts/aws-cleanup.sh
new file mode 100755
index 0000000000..a62309ebf8
--- /dev/null
+++ b/scripts/aws-cleanup.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Helper script to clean up AWS Lambda functions created
+# by the test suite (tests/integrations/aws_lambda/test_aws.py).
+#
+# This will delete all Lambda functions named `test_function_*`.
+#
+
+export AWS_DEFAULT_REGION="us-east-1"
+export AWS_ACCESS_KEY_ID="$SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"
+export AWS_SECRET_ACCESS_KEY="$SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"
+
+for func in $(aws lambda list-functions --output text --query 'Functions[?starts_with(FunctionName, `test_function_`) == `true`].FunctionName'); do
+    echo "Deleting $func"
+    aws lambda delete-function --function-name "$func"
+done
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index a9030880ae..09cd0f64ae 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -13,6 +13,9 @@
 
     pip3 install click
     python3 tests/integrations/aws_lambda/client.py --runtime=python4.0
+
+
+You can use `scripts/aws-cleanup.sh` to delete all files generated by this test suite.
 """
 import base64
 import json

From 1fe4eb630283504b34c867d6574f9f506cdc2702 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 12:04:11 +0200
Subject: [PATCH 42/62] Using md5 now

---
 scripts/aws-cleanup.sh                  |  2 ++
 tests/integrations/aws_lambda/client.py | 11 ++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/aws-cleanup.sh b/scripts/aws-cleanup.sh
index a62309ebf8..6845267dc1 100755
--- a/scripts/aws-cleanup.sh
+++ b/scripts/aws-cleanup.sh
@@ -14,3 +14,5 @@ for func in $(aws lambda list-functions --output text --query 'Functions[?starts
     echo "Deleting $func"
     aws lambda delete-function --function-name "$func"
 done
+
+echo "All done! Have a nice day!"
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 898e3e9bc9..782972c0db 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -1,9 +1,10 @@
-import sys
+import base64
+import boto3
+import hashlib
 import os
-import tempfile
 import subprocess
-import boto3
-import base64
+import sys
+import tempfile
 
 AWS_REGION_NAME = "us-east-1"
 AWS_CREDENTIALS = {
@@ -177,7 +178,7 @@ def run_lambda_function(
     """
     subprocess_kwargs = dict(subprocess_kwargs)
 
-    function_hash = str(hash(code)).replace("-", "_")
+    function_hash = hashlib.md5(code.encode("utf-8")).hexdigest()
     fn_name = "test_function_{}".format(function_hash)
 
     tmp_base_dir = tempfile.gettempdir()

From 612c23f97bb3ee538e529172f19cea8e7f8bf204 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 13:20:24 +0200
Subject: [PATCH 43/62] Speed up things by not recreating function already
 present in AWS

---
 tests/integrations/aws_lambda/client.py | 150 ++++++++++++++----------
 1 file changed, 88 insertions(+), 62 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 782972c0db..4fe97ea3e6 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -180,78 +180,95 @@ def run_lambda_function(
 
     function_hash = hashlib.md5(code.encode("utf-8")).hexdigest()
     fn_name = "test_function_{}".format(function_hash)
+    full_fn_name = fn_name + runtime.replace(".", "")
 
-    tmp_base_dir = tempfile.gettempdir()
-    base_dir = os.path.join(tmp_base_dir, fn_name)
-    dir_already_existing = os.path.isdir(base_dir)
+    function_exists_in_aws = True
+    try:
+        client.get_function(
+            FunctionName=full_fn_name,
+        )
+        print(
+            "Lambda function in AWS already existing, taking it (and do not create a local one)"
+        )
+    except client.exceptions.ResourceNotFoundException:
+        function_exists_in_aws = False
 
-    if dir_already_existing:
-        print("Lambda function directory already exists, skipping creation")
+    if not function_exists_in_aws:
+        tmp_base_dir = tempfile.gettempdir()
+        base_dir = os.path.join(tmp_base_dir, fn_name)
+        dir_already_existing = os.path.isdir(base_dir)
 
-    if not dir_already_existing:
-        os.mkdir(base_dir)
-        _create_lambda_package(
-            base_dir, code, initial_handler, layer, syntax_check, subprocess_kwargs
-        )
+        if dir_already_existing:
+            print("Local Lambda function directory already exists, skipping creation")
 
-        @add_finalizer
-        def clean_up():
-            # this closes the web socket so we don't get a
-            #   ResourceWarning: unclosed <ssl.SSLSocket ... >
-            # warning on every test
-            # based on https://github.com/boto/botocore/pull/1810
-            # (if that's ever merged, this can just become client.close())
-            session = client._endpoint.http_session
-            managers = [session._manager] + list(session._proxy_managers.values())
-            for manager in managers:
-                manager.clear()
-
-    layers = []
-    environment = {}
-    handler = initial_handler or "test_lambda.test_handler"
-
-    if layer is not None:
-        with open(
-            os.path.join(base_dir, "lambda-layer-package.zip"), "rb"
-        ) as lambda_layer_zip:
-            response = client.publish_layer_version(
-                LayerName="python-serverless-sdk-test",
-                Description="Created as part of testsuite for getsentry/sentry-python",
-                Content={"ZipFile": lambda_layer_zip.read()},
+        if not dir_already_existing:
+            os.mkdir(base_dir)
+            _create_lambda_package(
+                base_dir, code, initial_handler, layer, syntax_check, subprocess_kwargs
             )
 
-        layers = [response["LayerVersionArn"]]
-        handler = "sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler"
-        environment = {
-            "Variables": {
-                "SENTRY_INITIAL_HANDLER": initial_handler or "test_lambda.test_handler",
-                "SENTRY_DSN": "https://123abc@example.com/123",
-                "SENTRY_TRACES_SAMPLE_RATE": "1.0",
+            @add_finalizer
+            def clean_up():
+                # this closes the web socket so we don't get a
+                #   ResourceWarning: unclosed <ssl.SSLSocket ... >
+                # warning on every test
+                # based on https://github.com/boto/botocore/pull/1810
+                # (if that's ever merged, this can just become client.close())
+                session = client._endpoint.http_session
+                managers = [session._manager] + list(session._proxy_managers.values())
+                for manager in managers:
+                    manager.clear()
+
+        layers = []
+        environment = {}
+        handler = initial_handler or "test_lambda.test_handler"
+
+        if layer is not None:
+            with open(
+                os.path.join(base_dir, "lambda-layer-package.zip"), "rb"
+            ) as lambda_layer_zip:
+                response = client.publish_layer_version(
+                    LayerName="python-serverless-sdk-test",
+                    Description="Created as part of testsuite for getsentry/sentry-python",
+                    Content={"ZipFile": lambda_layer_zip.read()},
+                )
+
+            layers = [response["LayerVersionArn"]]
+            handler = (
+                "sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler"
+            )
+            environment = {
+                "Variables": {
+                    "SENTRY_INITIAL_HANDLER": initial_handler
+                    or "test_lambda.test_handler",
+                    "SENTRY_DSN": "https://123abc@example.com/123",
+                    "SENTRY_TRACES_SAMPLE_RATE": "1.0",
+                }
             }
-        }
 
-    full_fn_name = fn_name + runtime.replace(".", "")
-    try:
-        with open(
-            os.path.join(base_dir, "lambda-function-package.zip"), "rb"
-        ) as lambda_function_zip:
-            client.create_function(
-                Description="Created as part of testsuite for getsentry/sentry-python",
-                FunctionName=full_fn_name,
-                Runtime=runtime,
-                Timeout=timeout,
-                Role=AWS_LAMBDA_EXECUTION_ROLE_ARN,
-                Handler=handler,
-                Code={"ZipFile": lambda_function_zip.read()},
-                Environment=environment,
-                Layers=layers,
+        try:
+            with open(
+                os.path.join(base_dir, "lambda-function-package.zip"), "rb"
+            ) as lambda_function_zip:
+                client.create_function(
+                    Description="Created as part of testsuite for getsentry/sentry-python",
+                    FunctionName=full_fn_name,
+                    Runtime=runtime,
+                    Timeout=timeout,
+                    Role=AWS_LAMBDA_EXECUTION_ROLE_ARN,
+                    Handler=handler,
+                    Code={"ZipFile": lambda_function_zip.read()},
+                    Environment=environment,
+                    Layers=layers,
+                )
+
+                waiter = client.get_waiter("function_active_v2")
+                waiter.wait(FunctionName=full_fn_name)
+        except client.exceptions.ResourceConflictException:
+            print(
+                "Lambda function already exists, this is fine, we will just invoke it."
             )
 
-            waiter = client.get_waiter("function_active_v2")
-            waiter.wait(FunctionName=full_fn_name)
-    except client.exceptions.ResourceConflictException:
-        print("Lambda function already exists, this is fine, we will just invoke it.")
-
     response = client.invoke(
         FunctionName=full_fn_name,
         InvocationType="RequestResponse",
@@ -263,6 +280,15 @@ def clean_up():
     return response
 
 
+# This is for inspecting new Python runtime environments in AWS Lambda
+# If you need to debug a new runtime, use this REPL to run arbitrary Python or bash commands
+# in that runtime in a Lambda function:
+#
+#    pip3 install click
+#    python3 tests/integrations/aws_lambda/client.py --runtime=python4.0
+#
+
+
 _REPL_CODE = """
 import os
 

From 1803273a8fede198ba03aa1242377373659d8403 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 13:30:41 +0200
Subject: [PATCH 44/62] Better caching and nicer function names

---
 tests/integrations/aws_lambda/client.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 4fe97ea3e6..6c992dd391 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -6,6 +6,8 @@
 import sys
 import tempfile
 
+from sentry_sdk.consts import VERSION as SDK_VERSION
+
 AWS_REGION_NAME = "us-east-1"
 AWS_CREDENTIALS = {
     "aws_access_key_id": os.environ["SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"],
@@ -178,9 +180,9 @@ def run_lambda_function(
     """
     subprocess_kwargs = dict(subprocess_kwargs)
 
-    function_hash = hashlib.md5(code.encode("utf-8")).hexdigest()
+    function_hash = hashlib.md5((code + SDK_VERSION).encode("utf-8")).hexdigest()
     fn_name = "test_function_{}".format(function_hash)
-    full_fn_name = fn_name + runtime.replace(".", "")
+    full_fn_name = fn_name + "_" + runtime.replace(".", "")
 
     function_exists_in_aws = True
     try:

From 9c1cae32db9124bba0c784d2e2044bd0ba9325fe Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 13:53:32 +0200
Subject: [PATCH 45/62] Make sure EVENT and ENVELOPE elog entries are always on
 a new line.

---
 tests/integrations/aws_lambda/test_aws.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 09cd0f64ae..67693113b5 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -104,14 +104,10 @@ def envelope_processor(envelope):
 class TestTransport(HttpTransport):
     def _send_event(self, event):
         event = event_processor(event)
-        print("x")  # force AWS lambda logging to start a new line
-                    # (when printing a stacktrace it swallows the \\n from the next print statement)
         print("\\nEVENT: {}\\n".format(json.dumps(event)))
 
     def _send_envelope(self, envelope):
         envelope = envelope_processor(envelope)
-        print("x")  # force AWS lambda logging to start a new line
-                    # (when printing a stacktrace it swallows the \\n from the next print statement)
         print("\\nENVELOPE: {}\\n".format(json.dumps(envelope)))
 
 def init_sdk(timeout_warning=False, **extra_init_args):
@@ -162,8 +158,13 @@ def inner(
             initial_handler=initial_handler,
         )
 
-        # for better debugging
-        response["LogResult"] = base64.b64decode(response["LogResult"]).splitlines()
+        # Make sure the "ENVELOPE:" and "EVENT:" log entries are always starting a new line. (Sometimes they don't.)
+        response["LogResult"] = (
+            base64.b64decode(response["LogResult"])
+            .replace(b"EVENT:", b"\nEVENT:")
+            .replace(b"ENVELOPE:", b"\nENVELOPE:")
+            .splitlines()
+        )
         response["Payload"] = json.loads(response["Payload"].read().decode("utf-8"))
         del response["ResponseMetadata"]
 

From f19f0ad21eccc9e37936aff9f2e75f5584627191 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 14:21:17 +0200
Subject: [PATCH 46/62] Saving some characters for correct output from AWS

---
 scripts/aws-cleanup.sh                    |  2 +-
 tests/integrations/aws_lambda/client.py   |  9 ++++++---
 tests/integrations/aws_lambda/test_aws.py | 16 ++++++++--------
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/scripts/aws-cleanup.sh b/scripts/aws-cleanup.sh
index 6845267dc1..7b176b796d 100755
--- a/scripts/aws-cleanup.sh
+++ b/scripts/aws-cleanup.sh
@@ -10,7 +10,7 @@ export AWS_DEFAULT_REGION="us-east-1"
 export AWS_ACCESS_KEY_ID="$SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"
 export AWS_SECRET_ACCESS_KEY="$SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"
 
-for func in $(aws lambda list-functions --output text --query 'Functions[?starts_with(FunctionName, `test_function_`) == `true`].FunctionName'); do
+for func in $(aws lambda list-functions --output text --query 'Functions[?starts_with(FunctionName, `tstfun_`) == `true`].FunctionName'); do
     echo "Deleting $func"
     aws lambda delete-function --function-name "$func"
 done
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 6c992dd391..e601a25c75 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -180,9 +180,12 @@ def run_lambda_function(
     """
     subprocess_kwargs = dict(subprocess_kwargs)
 
-    function_hash = hashlib.md5((code + SDK_VERSION).encode("utf-8")).hexdigest()
-    fn_name = "test_function_{}".format(function_hash)
-    full_fn_name = fn_name + "_" + runtime.replace(".", "")
+    function_hash = hashlib.shake_256((code + SDK_VERSION).encode("utf-8")).hexdigest(5)
+    fn_name = "tstfun_{}".format(function_hash)
+    full_fn_name = fn_name + "_" + runtime.replace(".", "").replace("python", "py")
+    import ipdb
+
+    ipdb.set_trace()
 
     function_exists_in_aws = True
     try:
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 67693113b5..5c5d0f9518 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -219,13 +219,13 @@ def test_handler(event, context):
     assert exception["mechanism"]["type"] == "aws_lambda"
     assert not exception["mechanism"]["handled"]
 
-    assert event["extra"]["lambda"]["function_name"].startswith("test_function_")
+    assert event["extra"]["lambda"]["function_name"].startswith("tstfun_")
 
     logs_url = event["extra"]["cloudwatch logs"]["url"]
     assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region=")
     assert not re.search("(=;|=$)", logs_url)
     assert event["extra"]["cloudwatch logs"]["log_group"].startswith(
-        "/aws/lambda/test_function_"
+        "/aws/lambda/tstfun_"
     )
 
     log_stream_re = "^[0-9]{4}/[0-9]{2}/[0-9]{2}/\\[[^\\]]+][a-f0-9]+$"
@@ -356,13 +356,13 @@ def test_handler(event, context):
     assert exception["mechanism"]["type"] == "threading"
     assert not exception["mechanism"]["handled"]
 
-    assert event["extra"]["lambda"]["function_name"].startswith("test_function_")
+    assert event["extra"]["lambda"]["function_name"].startswith("tstfun_")
 
     logs_url = event["extra"]["cloudwatch logs"]["url"]
     assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region=")
     assert not re.search("(=;|=$)", logs_url)
     assert event["extra"]["cloudwatch logs"]["log_group"].startswith(
-        "/aws/lambda/test_function_"
+        "/aws/lambda/tstfun_"
     )
 
     log_stream_re = "^[0-9]{4}/[0-9]{2}/[0-9]{2}/\\[[^\\]]+][a-f0-9]+$"
@@ -389,7 +389,7 @@ def test_handler(event, context):
 
     assert envelope["type"] == "transaction"
     assert envelope["contexts"]["trace"]["op"] == "function.aws"
-    assert envelope["transaction"].startswith("test_function_")
+    assert envelope["transaction"].startswith("tstfun_")
     assert envelope["transaction"] in envelope["request"]["url"]
 
 
@@ -419,7 +419,7 @@ def test_handler(event, context):
 
     assert transaction_event["type"] == "transaction"
     assert transaction_event["contexts"]["trace"]["op"] == "function.aws"
-    assert transaction_event["transaction"].startswith("test_function_")
+    assert transaction_event["transaction"].startswith("tstfun_")
     assert transaction_event["transaction"] in transaction_event["request"]["url"]
 
 
@@ -506,7 +506,7 @@ def test_handler(event, context):
     assert error_event["contexts"]["trace"]["op"] == "function.aws"
 
     function_name = error_event["extra"]["lambda"]["function_name"]
-    assert function_name.startswith("test_function_")
+    assert function_name.startswith("tstfun_")
     assert error_event["transaction"] == function_name
 
     exception = error_event["exception"]["values"][0]
@@ -618,7 +618,7 @@ def test_handler(event, context):
                                 "aws_context": ObjectDescribedBy(
                                     type=get_lambda_bootstrap().LambdaContext,
                                     attrs={
-                                        'function_name': StringContaining("test_function"),
+                                        'function_name': StringContaining("tstfun_"),
                                         'function_version': '$LATEST',
                                     }
                                 )

From 16b6eb5d8059a8cf0a0ecb485cf86087c5fead9d Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 14:24:53 +0200
Subject: [PATCH 47/62] Cleanup

---
 tests/integrations/aws_lambda/client.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index e601a25c75..5bf38660c4 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -180,12 +180,12 @@ def run_lambda_function(
     """
     subprocess_kwargs = dict(subprocess_kwargs)
 
+    # Making a unique function name depending on all the code that is run in it (function code plus SDK version)
+    # The name needs to be short so the generated event/envelope json blobs are small enought to be output
+    # in the log result of the Lambda function.
     function_hash = hashlib.shake_256((code + SDK_VERSION).encode("utf-8")).hexdigest(5)
     fn_name = "tstfun_{}".format(function_hash)
     full_fn_name = fn_name + "_" + runtime.replace(".", "").replace("python", "py")
-    import ipdb
-
-    ipdb.set_trace()
 
     function_exists_in_aws = True
     try:

From 23e7432f6d7dd08efb2510bd433a5240d3b396e3 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 14:31:31 +0200
Subject: [PATCH 48/62] Better name

---
 scripts/aws-cleanup.sh                    |  2 +-
 tests/integrations/aws_lambda/client.py   |  6 ++++--
 tests/integrations/aws_lambda/test_aws.py | 16 ++++++++--------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/scripts/aws-cleanup.sh b/scripts/aws-cleanup.sh
index 7b176b796d..982835c283 100755
--- a/scripts/aws-cleanup.sh
+++ b/scripts/aws-cleanup.sh
@@ -10,7 +10,7 @@ export AWS_DEFAULT_REGION="us-east-1"
 export AWS_ACCESS_KEY_ID="$SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID"
 export AWS_SECRET_ACCESS_KEY="$SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY"
 
-for func in $(aws lambda list-functions --output text --query 'Functions[?starts_with(FunctionName, `tstfun_`) == `true`].FunctionName'); do
+for func in $(aws lambda list-functions --output text --query 'Functions[?starts_with(FunctionName, `test_`) == `true`].FunctionName'); do
     echo "Deleting $func"
     aws lambda delete-function --function-name "$func"
 done
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 5bf38660c4..9ad7544718 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -184,8 +184,10 @@ def run_lambda_function(
     # The name needs to be short so the generated event/envelope json blobs are small enought to be output
     # in the log result of the Lambda function.
     function_hash = hashlib.shake_256((code + SDK_VERSION).encode("utf-8")).hexdigest(5)
-    fn_name = "tstfun_{}".format(function_hash)
-    full_fn_name = fn_name + "_" + runtime.replace(".", "").replace("python", "py")
+    fn_name = "test_{}".format(function_hash)
+    full_fn_name = "{}_{}".format(
+        fn_name, runtime.replace(".", "").replace("python", "py")
+    )
 
     function_exists_in_aws = True
     try:
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 5c5d0f9518..7d8f134cbc 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -219,13 +219,13 @@ def test_handler(event, context):
     assert exception["mechanism"]["type"] == "aws_lambda"
     assert not exception["mechanism"]["handled"]
 
-    assert event["extra"]["lambda"]["function_name"].startswith("tstfun_")
+    assert event["extra"]["lambda"]["function_name"].startswith("test_")
 
     logs_url = event["extra"]["cloudwatch logs"]["url"]
     assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region=")
     assert not re.search("(=;|=$)", logs_url)
     assert event["extra"]["cloudwatch logs"]["log_group"].startswith(
-        "/aws/lambda/tstfun_"
+        "/aws/lambda/test_"
     )
 
     log_stream_re = "^[0-9]{4}/[0-9]{2}/[0-9]{2}/\\[[^\\]]+][a-f0-9]+$"
@@ -356,13 +356,13 @@ def test_handler(event, context):
     assert exception["mechanism"]["type"] == "threading"
     assert not exception["mechanism"]["handled"]
 
-    assert event["extra"]["lambda"]["function_name"].startswith("tstfun_")
+    assert event["extra"]["lambda"]["function_name"].startswith("test_")
 
     logs_url = event["extra"]["cloudwatch logs"]["url"]
     assert logs_url.startswith("https://console.aws.amazon.com/cloudwatch/home?region=")
     assert not re.search("(=;|=$)", logs_url)
     assert event["extra"]["cloudwatch logs"]["log_group"].startswith(
-        "/aws/lambda/tstfun_"
+        "/aws/lambda/test_"
     )
 
     log_stream_re = "^[0-9]{4}/[0-9]{2}/[0-9]{2}/\\[[^\\]]+][a-f0-9]+$"
@@ -389,7 +389,7 @@ def test_handler(event, context):
 
     assert envelope["type"] == "transaction"
     assert envelope["contexts"]["trace"]["op"] == "function.aws"
-    assert envelope["transaction"].startswith("tstfun_")
+    assert envelope["transaction"].startswith("test_")
     assert envelope["transaction"] in envelope["request"]["url"]
 
 
@@ -419,7 +419,7 @@ def test_handler(event, context):
 
     assert transaction_event["type"] == "transaction"
     assert transaction_event["contexts"]["trace"]["op"] == "function.aws"
-    assert transaction_event["transaction"].startswith("tstfun_")
+    assert transaction_event["transaction"].startswith("test_")
     assert transaction_event["transaction"] in transaction_event["request"]["url"]
 
 
@@ -506,7 +506,7 @@ def test_handler(event, context):
     assert error_event["contexts"]["trace"]["op"] == "function.aws"
 
     function_name = error_event["extra"]["lambda"]["function_name"]
-    assert function_name.startswith("tstfun_")
+    assert function_name.startswith("test_")
     assert error_event["transaction"] == function_name
 
     exception = error_event["exception"]["values"][0]
@@ -618,7 +618,7 @@ def test_handler(event, context):
                                 "aws_context": ObjectDescribedBy(
                                     type=get_lambda_bootstrap().LambdaContext,
                                     attrs={
-                                        'function_name': StringContaining("tstfun_"),
+                                        'function_name': StringContaining("test_"),
                                         'function_version': '$LATEST',
                                     }
                                 )

From 8720e7cc61b28221f79853ac5f711b58e21aa3da Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 15:16:53 +0200
Subject: [PATCH 49/62] Docs

---
 tests/integrations/aws_lambda/test_aws.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 7d8f134cbc..cfc3ef90f4 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -1,11 +1,16 @@
 """
-# AWS Lambda system tests
+# AWS Lambda System Tests
 
 This testsuite uses boto3 to upload actual Lambda functions to AWS Lambda and invoke them.
 
-For running test locally you need to set these env vars (You can find the values in the Sentry password manager):
-export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID="..."
-export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY="..."
+For running test locally you need to set these env vars
+(You can find the values in the Sentry password manager by search for "AWS Lambda for Python SDK Tests"):
+
+    export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID="..."
+    export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY="..."
+
+
+You can use `scripts/aws-cleanup.sh` to delete all files generated by this test suite.
 
 
 If you need to debug a new runtime, use this REPL to run arbitrary Python or bash commands
@@ -13,10 +18,8 @@
 
     pip3 install click
     python3 tests/integrations/aws_lambda/client.py --runtime=python4.0
-
-
-You can use `scripts/aws-cleanup.sh` to delete all files generated by this test suite.
 """
+
 import base64
 import json
 import re
@@ -24,6 +27,7 @@
 
 import pytest
 
+
 LAMBDA_PRELUDE = """
 from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration, get_lambda_bootstrap
 import sentry_sdk

From de4d7d653a3d2605d1495d8dcc63194b587adb13 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 15:17:47 +0200
Subject: [PATCH 50/62] Docs

---
 tests/integrations/aws_lambda/test_aws.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index cfc3ef90f4..581ca5dcc7 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -3,8 +3,8 @@
 
 This testsuite uses boto3 to upload actual Lambda functions to AWS Lambda and invoke them.
 
-For running test locally you need to set these env vars
-(You can find the values in the Sentry password manager by search for "AWS Lambda for Python SDK Tests"):
+For running test locally you need to set these env vars:
+(You can find the values in the Sentry password manager by searching for "AWS Lambda for Python SDK Tests").
 
     export SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID="..."
     export SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY="..."

From cbda4ebd4f13230e497a04b88ac2c5cba7e9ac18 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 15:45:26 +0200
Subject: [PATCH 51/62] Cleanup

---
 scripts/build_aws_lambda_layer.py       | 22 ++++++++++++++++++----
 tests/integrations/aws_lambda/client.py |  2 +-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/scripts/build_aws_lambda_layer.py b/scripts/build_aws_lambda_layer.py
index 4d4703273c..a46b48104d 100644
--- a/scripts/build_aws_lambda_layer.py
+++ b/scripts/build_aws_lambda_layer.py
@@ -90,21 +90,35 @@ def zip(self):
         )
 
 
-def build_packaged_zip(dest_abs_path=None, make_dist=False, out_zip_filename=None):
-    if dest_abs_path is None:
-        dest_abs_path = tempfile.mkdtemp()
+def build_packaged_zip(base_dir=None, make_dist=False, out_zip_filename=None):
+    if base_dir is None:
+        base_dir = tempfile.mkdtemp()
 
     if make_dist:
+        # Same thing that is done by "make dist"
+        # (which is a dependency of "make aws-lambda-layer")
         subprocess.check_call(
             [sys.executable, "setup.py", "sdist", "bdist_wheel", "-d", DIST_PATH],
         )
 
-    layer_builder = LayerBuilder(dest_abs_path, out_zip_filename=out_zip_filename)
+    layer_builder = LayerBuilder(base_dir, out_zip_filename=out_zip_filename)
     layer_builder.make_directories()
     layer_builder.install_python_packages()
     layer_builder.create_init_serverless_sdk_package()
     layer_builder.zip()
 
+    print("Created Lambda Layer package with this information:")
+    print(" - Base directory for generating package: {}".format(layer_builder.base_dir))
+    print(
+        " - Created Python SDK distribution (in `{}`): {}".format(
+            os.path.abspath(DIST_PATH), make_dist
+        )
+    )
+    if not make_dist:
+        print("    If 'False' we assume it was already created (by 'make dist')")
+    print(" - Package zip filename: {}".format(layer_builder.out_zip_filename))
+    print(" - Copied package zip to: {}".format(os.path.abspath(DIST_PATH)))
+
 
 if __name__ == "__main__":
     build_packaged_zip()
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 9ad7544718..15779b25eb 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -104,7 +104,7 @@ def _create_lambda_package(
         from scripts.build_aws_lambda_layer import build_packaged_zip
 
         build_packaged_zip(
-            dest_abs_path=base_dir,
+            base_dir=base_dir,
             make_dist=True,
             out_zip_filename="lambda-layer-package.zip",
         )

From a410a333767d863fe135e4185238c715c9560344 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 15:47:56 +0200
Subject: [PATCH 52/62] Cleanup

---
 scripts/build_aws_lambda_layer.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/build_aws_lambda_layer.py b/scripts/build_aws_lambda_layer.py
index a46b48104d..de8eded702 100644
--- a/scripts/build_aws_lambda_layer.py
+++ b/scripts/build_aws_lambda_layer.py
@@ -107,17 +107,17 @@ def build_packaged_zip(base_dir=None, make_dist=False, out_zip_filename=None):
     layer_builder.create_init_serverless_sdk_package()
     layer_builder.zip()
 
+    # Just for debugging
+    dist_path = os.path.abspath(DIST_PATH)
     print("Created Lambda Layer package with this information:")
     print(" - Base directory for generating package: {}".format(layer_builder.base_dir))
     print(
-        " - Created Python SDK distribution (in `{}`): {}".format(
-            os.path.abspath(DIST_PATH), make_dist
-        )
+        " - Created Python SDK distribution (in `{}`): {}".format(dist_path, make_dist)
     )
     if not make_dist:
         print("    If 'False' we assume it was already created (by 'make dist')")
     print(" - Package zip filename: {}".format(layer_builder.out_zip_filename))
-    print(" - Copied package zip to: {}".format(os.path.abspath(DIST_PATH)))
+    print(" - Copied package zip to: {}".format(dist_path))
 
 
 if __name__ == "__main__":

From fbf6f2e4316b94ede7c7a2903bc516761c12eed9 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Tue, 24 Oct 2023 20:37:15 +0200
Subject: [PATCH 53/62] Added some clarification

---
 .craft.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.craft.yml b/.craft.yml
index 3f8433d9fc..e8454a2754 100644
--- a/.craft.yml
+++ b/.craft.yml
@@ -18,6 +18,8 @@ targets:
           # On the other hand, AWS Lambda does not support every Python runtime.
           # The supported runtimes are available in the following link:
           # https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html
+          # We do not support runtimes below 3.9 because those runtimes have OpenSSL 1.0.x
+          # installed, and the version of urrlib that we use requires OpenSSL 1.1.1+
           - python3.9
           - python3.10
           - python3.11

From 080a7946298536ea9e382b09b558424a3b2dceb3 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 25 Oct 2023 15:16:01 +0200
Subject: [PATCH 54/62] Found how to pin dependencies only for Lambda layers!
 This fixes all openssl problems in lambda layers.

---
 .craft.yml                        | 4 ++--
 Makefile                          | 3 +--
 aws-lambda-layer-requirements.txt | 7 +++++++
 3 files changed, 10 insertions(+), 4 deletions(-)
 create mode 100644 aws-lambda-layer-requirements.txt

diff --git a/.craft.yml b/.craft.yml
index e8454a2754..21d4fc7496 100644
--- a/.craft.yml
+++ b/.craft.yml
@@ -18,8 +18,8 @@ targets:
           # On the other hand, AWS Lambda does not support every Python runtime.
           # The supported runtimes are available in the following link:
           # https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html
-          # We do not support runtimes below 3.9 because those runtimes have OpenSSL 1.0.x
-          # installed, and the version of urrlib that we use requires OpenSSL 1.1.1+
+          - python3.7
+          - python3.8
           - python3.9
           - python3.10
           - python3.11
diff --git a/Makefile b/Makefile
index 2011b1b63e..4d93d5341f 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,6 @@ apidocs-hotfix: apidocs
 .PHONY: apidocs-hotfix
 
 aws-lambda-layer: dist
-	$(VENV_PATH)/bin/pip install urllib3
-	$(VENV_PATH)/bin/pip install certifi
+	$(VENV_PATH)/bin/pip install -r aws-lambda-layer-requirements.txt
 	$(VENV_PATH)/bin/python -m scripts.build_aws_lambda_layer
 .PHONY: aws-lambda-layer
diff --git a/aws-lambda-layer-requirements.txt b/aws-lambda-layer-requirements.txt
new file mode 100644
index 0000000000..6ceafb26a1
--- /dev/null
+++ b/aws-lambda-layer-requirements.txt
@@ -0,0 +1,7 @@
+certifi
+
+# In Lambda functions botocore is used, and botocore is not
+# yet supporting urrlib3 1.27.0 never mind 2+.
+# So we pin this here to make our Lambda layer work with
+# Lambda Function using Python 3.7+
+urllib3<1.27

From ff066ea46601c894122e0080ca6de5e75427ca6c Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 25 Oct 2023 15:19:37 +0200
Subject: [PATCH 55/62] Update supported versions

---
 scripts/aws-deploy-local-layer.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/aws-deploy-local-layer.sh b/scripts/aws-deploy-local-layer.sh
index 57dcba6b55..56f2087596 100755
--- a/scripts/aws-deploy-local-layer.sh
+++ b/scripts/aws-deploy-local-layer.sh
@@ -22,7 +22,7 @@ aws lambda publish-layer-version \
     --region "eu-central-1" \
     --zip-file "fileb://dist/$ZIP" \
     --description "Local test build of SentryPythonServerlessSDK (can be deleted)" \
-    --compatible-runtimes python3.8 python3.9 python3.10 python3.11 \
+    --compatible-runtimes python3.7 python3.8 python3.9 python3.10 python3.11 \
     --no-cli-pager
 
 echo "Done deploying zipped Lambda layer to AWS as 'SentryPythonServerlessSDK-local-dev'."

From 940c77dae16f757fdc8ac3fabb1d10bb67456f57 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 25 Oct 2023 15:21:24 +0200
Subject: [PATCH 56/62] Small fix

---
 tests/integrations/aws_lambda/client.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 15779b25eb..3fbab556f4 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -319,7 +319,7 @@ def test_handler(event, context):
 
     @click.command()
     @click.option(
-        "--runtime", required=True, help="name of the runtime to use, eg python3.8"
+        "--runtime", required=True, help="name of the runtime to use, eg python3.11"
     )
     @click.option("--verbose", is_flag=True, default=False)
     def repl(runtime, verbose):

From cfd33e7861eedbb13134a4781f7330a3d66c4f16 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 25 Oct 2023 15:22:37 +0200
Subject: [PATCH 57/62] Apply suggestions from code review

Co-authored-by: Ivana Kellyerova <ivana.kellyerova@sentry.io>
---
 aws-lambda-layer-requirements.txt       | 2 +-
 tests/integrations/aws_lambda/client.py | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/aws-lambda-layer-requirements.txt b/aws-lambda-layer-requirements.txt
index 6ceafb26a1..8986fdafc0 100644
--- a/aws-lambda-layer-requirements.txt
+++ b/aws-lambda-layer-requirements.txt
@@ -1,7 +1,7 @@
 certifi
 
 # In Lambda functions botocore is used, and botocore is not
-# yet supporting urrlib3 1.27.0 never mind 2+.
+# yet supporting urllib3 1.27.0 never mind 2+.
 # So we pin this here to make our Lambda layer work with
 # Lambda Function using Python 3.7+
 urllib3<1.27
diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index 3fbab556f4..cce9e8da17 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -17,7 +17,7 @@
 AWS_LAMBDA_EXECUTION_ROLE_ARN = None
 
 
-def _install_depencencies(base_dir, subprocess_kwargs):
+def _install_dependencies(base_dir, subprocess_kwargs):
     """
     Installs dependencies for AWS Lambda function
     """
@@ -94,7 +94,7 @@ def _create_lambda_package(
         subprocess.check_call([sys.executable, test_lambda_py])
 
     if layer is None:
-        _install_depencencies(base_dir, subprocess_kwargs)
+        _install_dependencies(base_dir, subprocess_kwargs)
         _create_lambda_function_zip(base_dir)
 
     else:
@@ -173,7 +173,7 @@ def run_lambda_function(
     subprocess_kwargs=(),
 ):
     """
-    Creates a Lambda function with the given code, and invoces it.
+    Creates a Lambda function with the given code, and invokes it.
 
     If the same code is run multiple times the function will NOT be
     created anew each time but the existing function will be reused.
@@ -181,7 +181,7 @@ def run_lambda_function(
     subprocess_kwargs = dict(subprocess_kwargs)
 
     # Making a unique function name depending on all the code that is run in it (function code plus SDK version)
-    # The name needs to be short so the generated event/envelope json blobs are small enought to be output
+    # The name needs to be short so the generated event/envelope json blobs are small enough to be output
     # in the log result of the Lambda function.
     function_hash = hashlib.shake_256((code + SDK_VERSION).encode("utf-8")).hexdigest(5)
     fn_name = "test_{}".format(function_hash)

From 25967382246d67780db45c60036be3f9f3ce5c3a Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 25 Oct 2023 15:25:17 +0200
Subject: [PATCH 58/62] Test in all python versions supported by lambda

---
 tests/integrations/aws_lambda/test_aws.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index 581ca5dcc7..bf7eea0e90 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -134,6 +134,8 @@ def lambda_client():
 
 @pytest.fixture(
     params=[
+        "python3.7",
+        "python3.8",
         "python3.9",
         "python3.10",
         "python3.11",

From f7764c9ccee58401d66910de6b14105887ce05be Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 25 Oct 2023 17:20:49 +0200
Subject: [PATCH 59/62] Fixed lambda dependencies in tests

---
 tests/integrations/aws_lambda/client.py | 55 +++++++++++++++++++++----
 1 file changed, 46 insertions(+), 9 deletions(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index cce9e8da17..c91380f326 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -1,5 +1,6 @@
 import base64
 import boto3
+import glob
 import hashlib
 import os
 import subprocess
@@ -25,21 +26,56 @@ def _install_dependencies(base_dir, subprocess_kwargs):
     with open(setup_cfg, "w") as f:
         f.write("[install]\nprefix=")
 
+    # Install requirements for Lambda Layer (these are more limited than the SDK requirements,
+    # because Lambda does not support the newest versions of some packages)
     subprocess.check_call(
-        [sys.executable, "setup.py", "sdist", "-d", os.path.join(base_dir, "..")],
+        [
+            sys.executable,
+            "-m",
+            "pip",
+            "install",
+            "-r",
+            "aws-lambda-layer-requirements.txt",
+            "--target",
+            base_dir,
+        ],
         **subprocess_kwargs,
     )
+    # Install requirements used for testing
     subprocess.check_call(
-        "pip install mock==3.0.0 funcsigs -t .",
-        cwd=base_dir,
-        shell=True,
+        [
+            sys.executable,
+            "-m",
+            "pip",
+            "install",
+            "mock==3.0.0",
+            "funcsigs",
+            "--target",
+            base_dir,
+        ],
         **subprocess_kwargs,
     )
-    # https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
+    # Create a source distribution of the Sentry SDK (in parent directory of base_dir)
     subprocess.check_call(
-        "pip install ../*.tar.gz -t .",
-        cwd=base_dir,
-        shell=True,
+        [sys.executable, "setup.py", "sdist", "--dist-dir", os.path.dirname(base_dir)],
+        **subprocess_kwargs,
+    )
+    # Install the created Sentry SDK source distribution into the target directory
+    # Do not install the dependencies of the SDK, because they where installed by aws-lambda-layer-requirements.txt above
+    source_distribution_archive = glob.glob(
+        "{}/*.tar.gz".format(os.path.dirname(base_dir))
+    )[0]
+    subprocess.check_call(
+        [
+            sys.executable,
+            "-m",
+            "pip",
+            "install",
+            source_distribution_archive,
+            "--no-deps",
+            "--target",
+            base_dir,
+        ],
         **subprocess_kwargs,
     )
 
@@ -67,7 +103,8 @@ def _create_lambda_package(
     base_dir, code, initial_handler, layer, syntax_check, subprocess_kwargs
 ):
     """
-    Creates deployable packages (as zip files) for AWS Lambda function and layer
+    Creates deployable packages (as zip files) for AWS Lambda function
+    and optional the accompanying Sentry Lambda layer
     """
     if initial_handler:
         # If Initial handler value is provided i.e. it is not the default

From d3f48ef2f8d529db5d7bf637ae6e3af1f123d316 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Wed, 25 Oct 2023 17:21:39 +0200
Subject: [PATCH 60/62] Bend black to my will

---
 tests/integrations/aws_lambda/client.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/integrations/aws_lambda/client.py b/tests/integrations/aws_lambda/client.py
index c91380f326..c2bc90df93 100644
--- a/tests/integrations/aws_lambda/client.py
+++ b/tests/integrations/aws_lambda/client.py
@@ -57,7 +57,13 @@ def _install_dependencies(base_dir, subprocess_kwargs):
     )
     # Create a source distribution of the Sentry SDK (in parent directory of base_dir)
     subprocess.check_call(
-        [sys.executable, "setup.py", "sdist", "--dist-dir", os.path.dirname(base_dir)],
+        [
+            sys.executable,
+            "setup.py",
+            "sdist",
+            "--dist-dir",
+            os.path.dirname(base_dir),
+        ],
         **subprocess_kwargs,
     )
     # Install the created Sentry SDK source distribution into the target directory

From 784f61767b1af68adaa69f921f5548be624dd0ec Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 30 Oct 2023 12:37:18 +0100
Subject: [PATCH 61/62] Fixing tests

---
 scripts/build_aws_lambda_layer.py         | 16 ++++++++++++++++
 tests/integrations/aws_lambda/test_aws.py |  9 +++++++++
 2 files changed, 25 insertions(+)

diff --git a/scripts/build_aws_lambda_layer.py b/scripts/build_aws_lambda_layer.py
index de8eded702..8704e4de01 100644
--- a/scripts/build_aws_lambda_layer.py
+++ b/scripts/build_aws_lambda_layer.py
@@ -35,6 +35,21 @@ def make_directories(self):
 
     def install_python_packages(self):
         # type: (...) -> None
+        # Install requirements for Lambda Layer (these are more limited than the SDK requirements,
+        # because Lambda does not support the newest versions of some packages)
+        subprocess.check_call(
+            [
+                sys.executable,
+                "-m",
+                "pip",
+                "install",
+                "-r",
+                "aws-lambda-layer-requirements.txt",
+                "--target",
+                self.python_site_packages,
+            ],
+        )
+
         sentry_python_sdk = os.path.join(
             DIST_PATH,
             f"sentry_sdk-{SDK_VERSION}-py2.py3-none-any.whl",  # this is generated by "make dist" that is called by "make aws-lamber-layer"
@@ -44,6 +59,7 @@ def install_python_packages(self):
                 "pip",
                 "install",
                 "--no-cache-dir",  # always access PyPI
+                "--no-deps",  # the right depencencies have been installed in the call above
                 "--quiet",
                 sentry_python_sdk,
                 "--target",
diff --git a/tests/integrations/aws_lambda/test_aws.py b/tests/integrations/aws_lambda/test_aws.py
index bf7eea0e90..8904de1e52 100644
--- a/tests/integrations/aws_lambda/test_aws.py
+++ b/tests/integrations/aws_lambda/test_aws.py
@@ -18,6 +18,15 @@
 
     pip3 install click
     python3 tests/integrations/aws_lambda/client.py --runtime=python4.0
+
+IMPORTANT:
+
+During running of this test suite temporary folders will be created for compiling the Lambda functions.
+This temporary folders will not be cleaned up. This is because in CI generated files have to be shared
+between tests and thus the folders can not be deleted right after use.
+
+If you run your tests locally, you need to clean up the temporary folders manually. The location of
+the temporary folders is printed when running a test.
 """
 
 import base64

From 51d684356d7bd8c0c7b645e908e5cba2937a13b3 Mon Sep 17 00:00:00 2001
From: Anton Pirker <anton.pirker@sentry.io>
Date: Mon, 30 Oct 2023 14:06:57 +0100
Subject: [PATCH 62/62] Fixed quart tests

---
 tox.ini | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tox.ini b/tox.ini
index 7c16b71799..625482d5b8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -412,12 +412,15 @@ deps =
     quart-v0.16: blinker<1.6
     quart-v0.16: jinja2<3.1.0
     quart-v0.16: Werkzeug<2.1.0
+    quart-v0.16: hypercorn<0.15.0
     quart-v0.16: quart>=0.16.1,<0.17.0
     quart-v0.17: Werkzeug<3.0.0
     quart-v0.17: blinker<1.6
+    quart-v0.17: hypercorn<0.15.0
     quart-v0.17: quart>=0.17.0,<0.18.0
     quart-v0.18: Werkzeug<3.0.0
     quart-v0.18: quart>=0.18.0,<0.19.0
+    quart-v0.18: hypercorn<0.15.0
     quart-v0.19: Werkzeug>=3.0.0
     quart-v0.19: quart>=0.19.0,<0.20.0