From a345c7a83b518936aebafd4e54294b865ab076ca Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Fri, 10 Apr 2026 22:27:30 +0530 Subject: [PATCH 1/8] Changes for PLAT 15480 AWS tests --- bugsnag/asgi.py | 22 ++++++++++++++++++++++ bugsnag/tornado/__init__.py | 12 ++++++++---- features/aws-lambda/handled.feature | 3 +-- features/aws-lambda/sessions.feature | 2 +- features/aws-lambda/unhandled.feature | 2 +- features/celery.feature | 12 ++++++------ features/fixtures/aws-lambda/Dockerfile | 18 +++++++++++++++--- 7 files changed, 54 insertions(+), 17 deletions(-) diff --git a/bugsnag/asgi.py b/bugsnag/asgi.py index cd2141ee..1c9c5e48 100644 --- a/bugsnag/asgi.py +++ b/bugsnag/asgi.py @@ -1,9 +1,11 @@ from enum import Enum from typing import Any, List, Dict, Union, Optional +import logging import bugsnag from bugsnag.breadcrumbs import BreadcrumbType from bugsnag.legacy import _auto_leave_breadcrumb +from bugsnag.context import create_new_context from bugsnag.utils import remove_query_from_url, sanitize_url __all__ = ('BugsnagMiddleware',) @@ -116,6 +118,10 @@ def add_request_info(event): async def __call__(self, scope, receive, send): bugsnag.configure()._breadcrumbs.create_copy_for_context() + # create a fresh client-local context for this request so per-client + # state (feature flags, delegates, etc.) does not leak between + # requests handled by the same process. + create_new_context() bugsnag.configure_request(asgi_scope=scope) try: if bugsnag.configuration.auto_capture_sessions: @@ -133,6 +139,22 @@ async def __call__(self, scope, receive, send): except Exception as e: bugsnag.auto_notify(e, severity_reason=SEVERITY_REASON) raise + finally: + # Ensure per-request state (feature flags, metadata, etc.) and + # breadcrumbs are cleared after each ASGI request to avoid + # leaking state between requests. + try: + bugsnag.configure()._breadcrumbs.clear() + except Exception: + # Be defensive: don't let cleanup raise during request teardown + logger = logging.getLogger(__name__) + logger.exception("Error clearing breadcrumbs during ASGI teardown") + + try: + bugsnag.clear_request_config() + except Exception: + logger = logging.getLogger(__name__) + logger.exception("Error clearing Bugsnag request config during ASGI teardown") def _get_breadcrumb_metadata(scope) -> Dict[str, str]: diff --git a/bugsnag/tornado/__init__.py b/bugsnag/tornado/__init__.py index bfb869ca..ec8297b5 100644 --- a/bugsnag/tornado/__init__.py +++ b/bugsnag/tornado/__init__.py @@ -128,11 +128,15 @@ def _handle_request_exception(self, exc: BaseException): def prepare(self): middleware = bugsnag.configure().internal_middleware - bugsnag.configure().runtime_versions['tornado'] = tornado.version middleware.before_notify(self.add_tornado_request_to_notification) bugsnag.configure()._breadcrumbs.create_copy_for_context() create_new_context() + # tornado.version may be None in some environments; ensure we store + # a string in runtime_versions to satisfy type expectations. + tornado_version = tornado.version if tornado.version is not None else "" + bugsnag.configure().runtime_versions['tornado'] = tornado_version + _auto_leave_breadcrumb( 'http request', self._get_breadcrumb_metadata(), @@ -149,9 +153,9 @@ def _get_breadcrumb_metadata(self) -> Dict[str, str]: metadata = {'to': self.request.path} if 'Referer' in self.request.headers: - metadata['from'] = remove_query_from_url( - self.request.headers['Referer'] - ) + referer_url = remove_query_from_url(self.request.headers['Referer']) + if referer_url: + metadata['from'] = referer_url return metadata diff --git a/features/aws-lambda/handled.feature b/features/aws-lambda/handled.feature index ebb20a92..0060a70c 100644 --- a/features/aws-lambda/handled.feature +++ b/features/aws-lambda/handled.feature @@ -1,6 +1,5 @@ # 3.9 is currently the minimum python version with a lambda runtime -# 3.14 is not supported by the AWS `sam` CLI at the moment -@not-python-3.5 @not-python-3.6 @not-python-3.7 @not-python-3.8 @not-python-3.14 +@not-python-3.5 @not-python-3.6 @not-python-3.7 @not-python-3.8 Feature: Handled exceptions in AWS Lambda Scenario: Handled exceptions are delivered in an AWS Lambda app diff --git a/features/aws-lambda/sessions.feature b/features/aws-lambda/sessions.feature index 3e85cf99..ca3739ca 100644 --- a/features/aws-lambda/sessions.feature +++ b/features/aws-lambda/sessions.feature @@ -1,4 +1,4 @@ -@not-python-3.5 @not-python-3.6 @not-python-3.7 @not-python-3.8 @not-python-3.14 +@not-python-3.5 @not-python-3.6 @not-python-3.7 @not-python-3.8 Feature: Sessions in AWS Lambda Scenario: Manually started sessions are delivered in an AWS Lambda app when auto_capture_sessions is True diff --git a/features/aws-lambda/unhandled.feature b/features/aws-lambda/unhandled.feature index c21d43f1..f3c0acb6 100644 --- a/features/aws-lambda/unhandled.feature +++ b/features/aws-lambda/unhandled.feature @@ -1,4 +1,4 @@ -@not-python-3.5 @not-python-3.6 @not-python-3.7 @not-python-3.8 @not-python-3.14 +@not-python-3.5 @not-python-3.6 @not-python-3.7 @not-python-3.8 Feature: Unhandled exceptions in AWS Lambda Scenario: Unhandled exceptions are delivered in an AWS Lambda app diff --git a/features/celery.feature b/features/celery.feature index 3efe5ecc..85ca139e 100644 --- a/features/celery.feature +++ b/features/celery.feature @@ -12,7 +12,7 @@ Scenario Outline: Handled exceptions are delivered in Celery And the event "severityReason.type" equals "handledException" And the event "device.runtimeVersions.celery" matches "\.\d+\.\d+" - @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 + @not-python-3.11 @not-python-3.12 @not-python-3.13 Examples: | celery-version | | 4 | @@ -40,7 +40,7 @@ Scenario Outline: Unhandled exceptions are delivered in Celery And the event "metaData.extra_data.args" string is empty And the event "metaData.extra_data.kwargs" string is empty - @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 + @not-python-3.11 @not-python-3.12 @not-python-3.13 Examples: | celery-version | | 4 | @@ -72,7 +72,7 @@ Scenario Outline: Task arguments are added to metadata in Celery And the event "metaData.extra_data.args.1" equals "0" And the event "metaData.extra_data.kwargs" string is empty - @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 + @not-python-3.11 @not-python-3.12 @not-python-3.13 Examples: | celery-version | | 4 | @@ -116,7 +116,7 @@ Scenario Outline: Successful tasks do not report errors in Celery " Then I should receive no errors - @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 + @not-python-3.11 @not-python-3.12 @not-python-3.13 Examples: | celery-version | | 4 | @@ -131,7 +131,7 @@ Scenario Outline: Successful shared tasks do not report errors in Celery " Then I should receive no errors - @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 + @not-python-3.11 @not-python-3.12 @not-python-3.13 Examples: | celery-version | | 4 | diff --git a/features/fixtures/aws-lambda/Dockerfile b/features/fixtures/aws-lambda/Dockerfile index 55d953a6..6939f07b 100644 --- a/features/fixtures/aws-lambda/Dockerfile +++ b/features/fixtures/aws-lambda/Dockerfile @@ -1,9 +1,21 @@ ARG PYTHON_TEST_VERSION -FROM python:$PYTHON_TEST_VERSION +ARG SAM_CLI_VERSION +FROM python:${PYTHON_TEST_VERSION} -# install the SAM CLI +# disable SAM telemetry ENV SAM_CLI_TELEMETRY=0 -RUN pip install --upgrade pip && pip install aws-sam-cli + +# ensure system packages and CA certs are present so pip can reach PyPI, +# then install aws-sam-cli. Allow optional version via build-arg. +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates curl unzip build-essential && \ + rm -rf /var/lib/apt/lists/* && \ + python -m pip install --upgrade pip && \ + if [ -n "${SAM_CLI_VERSION}" ]; then \ + pip install --no-cache-dir aws-sam-cli==${SAM_CLI_VERSION}; \ + else \ + pip install --no-cache-dir aws-sam-cli; \ + fi COPY temp-bugsnag-python/ /usr/src/bugsnag From a96c674d6541dbec004c4cf45439ce8ab9723f24 Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Fri, 10 Apr 2026 23:19:09 +0530 Subject: [PATCH 2/8] Celery 4 scenarios supporting changes. --- features/celery.feature | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/features/celery.feature b/features/celery.feature index 85ca139e..3efe5ecc 100644 --- a/features/celery.feature +++ b/features/celery.feature @@ -12,7 +12,7 @@ Scenario Outline: Handled exceptions are delivered in Celery And the event "severityReason.type" equals "handledException" And the event "device.runtimeVersions.celery" matches "\.\d+\.\d+" - @not-python-3.11 @not-python-3.12 @not-python-3.13 + @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 Examples: | celery-version | | 4 | @@ -40,7 +40,7 @@ Scenario Outline: Unhandled exceptions are delivered in Celery And the event "metaData.extra_data.args" string is empty And the event "metaData.extra_data.kwargs" string is empty - @not-python-3.11 @not-python-3.12 @not-python-3.13 + @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 Examples: | celery-version | | 4 | @@ -72,7 +72,7 @@ Scenario Outline: Task arguments are added to metadata in Celery And the event "metaData.extra_data.args.1" equals "0" And the event "metaData.extra_data.kwargs" string is empty - @not-python-3.11 @not-python-3.12 @not-python-3.13 + @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 Examples: | celery-version | | 4 | @@ -116,7 +116,7 @@ Scenario Outline: Successful tasks do not report errors in Celery " Then I should receive no errors - @not-python-3.11 @not-python-3.12 @not-python-3.13 + @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 Examples: | celery-version | | 4 | @@ -131,7 +131,7 @@ Scenario Outline: Successful shared tasks do not report errors in Celery " Then I should receive no errors - @not-python-3.11 @not-python-3.12 @not-python-3.13 + @not-python-3.11 @not-python-3.12 @not-python-3.13 @not-python-3.14 Examples: | celery-version | | 4 | From 3311f72a983a4391732f1e3e188a00247ff57652 Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Fri, 10 Apr 2026 23:46:09 +0530 Subject: [PATCH 3/8] increased timeout value --- features/support/env.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/features/support/env.rb b/features/support/env.rb index 9f3ae675..29699ae0 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -16,11 +16,12 @@ def current_ip Maze.config.log_requests = true # don't wait so long for requests/not to receive requests - Maze.config.receive_requests_wait = 10 - Maze.config.receive_no_requests_wait = 10 + # Increased timeout to 30s for AWS Lambda cold starts (especially Python 3.12+) + Maze.config.receive_requests_wait = 30 + Maze.config.receive_no_requests_wait = 30 - # warn if a test takes more than 5 seconds to send a request - Maze.config.receive_requests_slow_threshold = 5 + # warn if a test takes more than 10 seconds to send a request + Maze.config.receive_requests_slow_threshold = 10 # bugsnag-python doesn't need to send the integrity header Maze.config.enforce_bugsnag_integrity = false From 13ac62e107dd9cef872c5350e81ce5270dbddbc0 Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Sat, 11 Apr 2026 00:33:04 +0530 Subject: [PATCH 4/8] asgi testing support and Flake8 Line Length changes --- bugsnag/asgi.py | 9 ++++++--- bugsnag/tornado/__init__.py | 6 ++++-- tests/integrations/test_asgi.py | 24 ++++++++++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/bugsnag/asgi.py b/bugsnag/asgi.py index 1c9c5e48..6190e6aa 100644 --- a/bugsnag/asgi.py +++ b/bugsnag/asgi.py @@ -146,15 +146,18 @@ async def __call__(self, scope, receive, send): try: bugsnag.configure()._breadcrumbs.clear() except Exception: - # Be defensive: don't let cleanup raise during request teardown + # Be defensive: don't let cleanup raise during teardown logger = logging.getLogger(__name__) - logger.exception("Error clearing breadcrumbs during ASGI teardown") + logger.exception( + "Error clearing breadcrumbs during ASGI teardown") try: bugsnag.clear_request_config() except Exception: logger = logging.getLogger(__name__) - logger.exception("Error clearing Bugsnag request config during ASGI teardown") + logger.exception( + "Error clearing Bugsnag request config during ASGI " + "teardown") def _get_breadcrumb_metadata(scope) -> Dict[str, str]: diff --git a/bugsnag/tornado/__init__.py b/bugsnag/tornado/__init__.py index ec8297b5..4a91cd2e 100644 --- a/bugsnag/tornado/__init__.py +++ b/bugsnag/tornado/__init__.py @@ -134,7 +134,8 @@ def prepare(self): # tornado.version may be None in some environments; ensure we store # a string in runtime_versions to satisfy type expectations. - tornado_version = tornado.version if tornado.version is not None else "" + tornado_version = ( + tornado.version if tornado.version is not None else "") bugsnag.configure().runtime_versions['tornado'] = tornado_version _auto_leave_breadcrumb( @@ -153,7 +154,8 @@ def _get_breadcrumb_metadata(self) -> Dict[str, str]: metadata = {'to': self.request.path} if 'Referer' in self.request.headers: - referer_url = remove_query_from_url(self.request.headers['Referer']) + referer_url = remove_query_from_url( + self.request.headers['Referer']) if referer_url: metadata['from'] = referer_url diff --git a/tests/integrations/test_asgi.py b/tests/integrations/test_asgi.py index e998f32f..bb5bed88 100644 --- a/tests/integrations/test_asgi.py +++ b/tests/integrations/test_asgi.py @@ -39,11 +39,12 @@ def test_routing_crash(self): async def other_func(): raise ScaryException('fell winds!') - @app.route('/') async def index(req): await other_func() return PlainTextResponse('pineapple') + app.add_route('/', index) + app = TestClient(BugsnagMiddleware(app)) self.assertRaises(ScaryException, lambda: app.get('/')) @@ -77,11 +78,12 @@ def test_enable_environment(self): async def other_func(): raise ScaryException('fell winds!') - @app.route('/') async def index(req): await other_func() return PlainTextResponse('pineapple') + app.add_route('/', index) + app = TestClient(BugsnagMiddleware(app)) self.assertRaises(ScaryException, lambda: app.get('/')) @@ -106,11 +108,12 @@ def test_headers_are_filtered(self): async def other_func(): raise ScaryException('fell winds!') - @app.route('/') async def index(req): await other_func() return PlainTextResponse('pineapple') + app.add_route('/', index) + app = TestClient(BugsnagMiddleware(app)) self.assertRaises( @@ -159,11 +162,12 @@ async def next_func(): bugsnag.configure_request(metadata={'wave': {'size': '35b'}}) raise ScaryException('fell winds!') - @app.route('/') async def index(req): await next_func() return PlainTextResponse('pineapple') + app.add_route('/', index) + app = TestClient(BugsnagMiddleware(app)) self.assertRaises(ScaryException, lambda: app.get('/')) @@ -229,10 +233,11 @@ async def app(scope, receive, send): def test_url_components(self): app = Starlette() - @app.route('/path') async def index(req): raise ScaryException('forgot the map') + app.add_route('/path', index) + app = TestClient(BugsnagMiddleware(app)) self.assertRaises( @@ -261,11 +266,12 @@ def test_breadcrumb_records_the_referer_header(self): async def other_func(): raise ScaryException('fell winds!') - @app.route('/') async def index(req): await other_func() return PlainTextResponse('pineapple') + app.add_route('/', index) + app = TestClient(BugsnagMiddleware(app)) headers = {'referer': 'http://testserver/abc/xyz?password=hunter2'} @@ -305,13 +311,14 @@ def test_chained_exceptions(self): async def other_func(): raise ScaryException('fell winds!') - @app.route('/') async def index(req): try: await other_func() except ScaryException as scary: raise Exception('disconcerting breeze.') from scary + app.add_route('/', index) + app = TestClient(BugsnagMiddleware(app)) with pytest.raises(Exception): @@ -351,7 +358,6 @@ async def other_func(): raise ScaryException('fell winds!') - @app.route('/') async def index(req): nonlocal count count += 1 @@ -360,6 +366,8 @@ async def index(req): await other_func() return PlainTextResponse('pineapple') + app.add_route('/', index) + app = TestClient(BugsnagMiddleware(app)) with pytest.raises(Exception): From 421c3ab9c2e5dc0bcd2b2c2dcaa9205f85d00d72 Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Mon, 13 Apr 2026 12:55:04 +0530 Subject: [PATCH 5/8] tornado: only set runtime_versions['tornado'] when version available --- bugsnag/tornado/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bugsnag/tornado/__init__.py b/bugsnag/tornado/__init__.py index 4a91cd2e..cbca5924 100644 --- a/bugsnag/tornado/__init__.py +++ b/bugsnag/tornado/__init__.py @@ -132,11 +132,12 @@ def prepare(self): bugsnag.configure()._breadcrumbs.create_copy_for_context() create_new_context() - # tornado.version may be None in some environments; ensure we store - # a string in runtime_versions to satisfy type expectations. - tornado_version = ( - tornado.version if tornado.version is not None else "") - bugsnag.configure().runtime_versions['tornado'] = tornado_version + # tornado.version may be None in some environments. Only set the + # runtime_versions entry when a real value is available to avoid + # exposing an empty-string sentinel to consumers. + tornado_version = tornado.version + if tornado_version is not None: + bugsnag.configure().runtime_versions['tornado'] = tornado_version _auto_leave_breadcrumb( 'http request', From 74993ceacaf58d099733582b8cb9084ea6f73f7a Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Mon, 13 Apr 2026 21:35:02 +0530 Subject: [PATCH 6/8] removing unwanted code. --- bugsnag/asgi.py | 25 ------------------------- features/support/env.rb | 1 - 2 files changed, 26 deletions(-) diff --git a/bugsnag/asgi.py b/bugsnag/asgi.py index 6190e6aa..cd2141ee 100644 --- a/bugsnag/asgi.py +++ b/bugsnag/asgi.py @@ -1,11 +1,9 @@ from enum import Enum from typing import Any, List, Dict, Union, Optional -import logging import bugsnag from bugsnag.breadcrumbs import BreadcrumbType from bugsnag.legacy import _auto_leave_breadcrumb -from bugsnag.context import create_new_context from bugsnag.utils import remove_query_from_url, sanitize_url __all__ = ('BugsnagMiddleware',) @@ -118,10 +116,6 @@ def add_request_info(event): async def __call__(self, scope, receive, send): bugsnag.configure()._breadcrumbs.create_copy_for_context() - # create a fresh client-local context for this request so per-client - # state (feature flags, delegates, etc.) does not leak between - # requests handled by the same process. - create_new_context() bugsnag.configure_request(asgi_scope=scope) try: if bugsnag.configuration.auto_capture_sessions: @@ -139,25 +133,6 @@ async def __call__(self, scope, receive, send): except Exception as e: bugsnag.auto_notify(e, severity_reason=SEVERITY_REASON) raise - finally: - # Ensure per-request state (feature flags, metadata, etc.) and - # breadcrumbs are cleared after each ASGI request to avoid - # leaking state between requests. - try: - bugsnag.configure()._breadcrumbs.clear() - except Exception: - # Be defensive: don't let cleanup raise during teardown - logger = logging.getLogger(__name__) - logger.exception( - "Error clearing breadcrumbs during ASGI teardown") - - try: - bugsnag.clear_request_config() - except Exception: - logger = logging.getLogger(__name__) - logger.exception( - "Error clearing Bugsnag request config during ASGI " - "teardown") def _get_breadcrumb_metadata(scope) -> Dict[str, str]: diff --git a/features/support/env.rb b/features/support/env.rb index 29699ae0..ab8ad48d 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -15,7 +15,6 @@ def current_ip Maze.config.file_log = false Maze.config.log_requests = true - # don't wait so long for requests/not to receive requests # Increased timeout to 30s for AWS Lambda cold starts (especially Python 3.12+) Maze.config.receive_requests_wait = 30 Maze.config.receive_no_requests_wait = 30 From bd92999592040d780c7760baa737ee42d13ea26a Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Mon, 13 Apr 2026 23:04:21 +0530 Subject: [PATCH 7/8] Suggestion from copilot. --- features/fixtures/aws-lambda/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/fixtures/aws-lambda/Dockerfile b/features/fixtures/aws-lambda/Dockerfile index 6939f07b..83b46b04 100644 --- a/features/fixtures/aws-lambda/Dockerfile +++ b/features/fixtures/aws-lambda/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ rm -rf /var/lib/apt/lists/* && \ python -m pip install --upgrade pip && \ if [ -n "${SAM_CLI_VERSION}" ]; then \ - pip install --no-cache-dir aws-sam-cli==${SAM_CLI_VERSION}; \ + pip install --no-cache-dir "aws-sam-cli==${SAM_CLI_VERSION}"; \ else \ pip install --no-cache-dir aws-sam-cli; \ fi From fd411418f87ea17fa0e1c1e3c5988e2be5e8647f Mon Sep 17 00:00:00 2001 From: SB-PawanN Date: Tue, 14 Apr 2026 15:27:26 +0530 Subject: [PATCH 8/8] removed extra codes --- bugsnag/tornado/__init__.py | 15 ++++----------- features/fixtures/aws-lambda/Dockerfile | 18 +++--------------- features/support/env.rb | 6 +++--- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/bugsnag/tornado/__init__.py b/bugsnag/tornado/__init__.py index cbca5924..bfb869ca 100644 --- a/bugsnag/tornado/__init__.py +++ b/bugsnag/tornado/__init__.py @@ -128,17 +128,11 @@ def _handle_request_exception(self, exc: BaseException): def prepare(self): middleware = bugsnag.configure().internal_middleware + bugsnag.configure().runtime_versions['tornado'] = tornado.version middleware.before_notify(self.add_tornado_request_to_notification) bugsnag.configure()._breadcrumbs.create_copy_for_context() create_new_context() - # tornado.version may be None in some environments. Only set the - # runtime_versions entry when a real value is available to avoid - # exposing an empty-string sentinel to consumers. - tornado_version = tornado.version - if tornado_version is not None: - bugsnag.configure().runtime_versions['tornado'] = tornado_version - _auto_leave_breadcrumb( 'http request', self._get_breadcrumb_metadata(), @@ -155,10 +149,9 @@ def _get_breadcrumb_metadata(self) -> Dict[str, str]: metadata = {'to': self.request.path} if 'Referer' in self.request.headers: - referer_url = remove_query_from_url( - self.request.headers['Referer']) - if referer_url: - metadata['from'] = referer_url + metadata['from'] = remove_query_from_url( + self.request.headers['Referer'] + ) return metadata diff --git a/features/fixtures/aws-lambda/Dockerfile b/features/fixtures/aws-lambda/Dockerfile index 83b46b04..55d953a6 100644 --- a/features/fixtures/aws-lambda/Dockerfile +++ b/features/fixtures/aws-lambda/Dockerfile @@ -1,21 +1,9 @@ ARG PYTHON_TEST_VERSION -ARG SAM_CLI_VERSION -FROM python:${PYTHON_TEST_VERSION} +FROM python:$PYTHON_TEST_VERSION -# disable SAM telemetry +# install the SAM CLI ENV SAM_CLI_TELEMETRY=0 - -# ensure system packages and CA certs are present so pip can reach PyPI, -# then install aws-sam-cli. Allow optional version via build-arg. -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates curl unzip build-essential && \ - rm -rf /var/lib/apt/lists/* && \ - python -m pip install --upgrade pip && \ - if [ -n "${SAM_CLI_VERSION}" ]; then \ - pip install --no-cache-dir "aws-sam-cli==${SAM_CLI_VERSION}"; \ - else \ - pip install --no-cache-dir aws-sam-cli; \ - fi +RUN pip install --upgrade pip && pip install aws-sam-cli COPY temp-bugsnag-python/ /usr/src/bugsnag diff --git a/features/support/env.rb b/features/support/env.rb index ab8ad48d..1fb69453 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -15,9 +15,9 @@ def current_ip Maze.config.file_log = false Maze.config.log_requests = true - # Increased timeout to 30s for AWS Lambda cold starts (especially Python 3.12+) - Maze.config.receive_requests_wait = 30 - Maze.config.receive_no_requests_wait = 30 + # Increased timeout to 20s for AWS Lambda cold starts (especially Python 3.12+) + Maze.config.receive_requests_wait = 20 + Maze.config.receive_no_requests_wait = 20 # warn if a test takes more than 10 seconds to send a request Maze.config.receive_requests_slow_threshold = 10