From 6cf357ebb8395e1e8863bb537cb340f60a3ef083 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 26 Aug 2026 14:19:23 +0200 Subject: [PATCH 1/2] ref(aws,gcp): Change timeout message --- MIGRATION_GUIDE.md | 1 + sentry_sdk/utils.py | 10 ++-------- tests/integrations/aws_lambda/test_aws_lambda.py | 4 +--- tests/integrations/gcp/test_gcp.py | 5 +---- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 373881daac..177868ee65 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -23,6 +23,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh - The UnraisableHookIntegration is now enabled by default. - We now don't suppress chained exceptions in the ASGI and asyncio integrations by default. The related `suppress_asgi_chained_exceptions` experimental option was removed. +- In the AWS Lambda and GCP integrations, the message of the warning the SDK optionally emits if a function is about to time out has changed. ## Removed diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index bc1017b7b6..2ddd81d566 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -1439,18 +1439,12 @@ def run(self) -> None: with sentry_sdk.scope.use_scope(self.current_scope): try: raise ServerlessTimeoutWarning( - "WARNING : Function is expected to get timed out. Configured timeout duration = {} seconds.".format( - integer_configured_timeout - ) + "WARNING: Function is about to time out." ) except Exception: reraise(*self._capture_exception()) - raise ServerlessTimeoutWarning( - "WARNING : Function is expected to get timed out. Configured timeout duration = {} seconds.".format( - integer_configured_timeout - ) - ) + raise ServerlessTimeoutWarning("WARNING: Function is about to time out.") def to_base64(original: str) -> "Optional[str]": diff --git a/tests/integrations/aws_lambda/test_aws_lambda.py b/tests/integrations/aws_lambda/test_aws_lambda.py index 02be52e69e..feda53551c 100644 --- a/tests/integrations/aws_lambda/test_aws_lambda.py +++ b/tests/integrations/aws_lambda/test_aws_lambda.py @@ -218,9 +218,7 @@ def test_timeout_error_scope_modified(lambda_client, test_environment): (exception,) = error_event["exception"]["values"] assert not exception["mechanism"]["handled"] assert exception["type"] == "ServerlessTimeoutWarning" - assert exception["value"].startswith( - "WARNING : Function is expected to get timed out. Configured timeout duration =" - ) + assert exception["value"] == "WARNING: Function is about to time out." assert exception["mechanism"]["type"] == "threading" assert error_event["tags"]["custom_tag"] == "custom_value" diff --git a/tests/integrations/gcp/test_gcp.py b/tests/integrations/gcp/test_gcp.py index b02518a413..d18ed02be1 100644 --- a/tests/integrations/gcp/test_gcp.py +++ b/tests/integrations/gcp/test_gcp.py @@ -231,10 +231,7 @@ def cloud_function(functionhandler, event): (exception,) = envelope_items[0]["exception"]["values"] assert exception["type"] == "ServerlessTimeoutWarning" - assert ( - exception["value"] - == "WARNING : Function is expected to get timed out. Configured timeout duration = 3 seconds." - ) + assert exception["value"] == "WARNING: Function is about to time out." assert exception["mechanism"]["type"] == "threading" assert not exception["mechanism"]["handled"] From fc40e556cd14fdd05f23eda138cf8d3081c6acc6 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Wed, 26 Aug 2026 14:43:33 +0200 Subject: [PATCH 2/2] remove unused timout calc --- sentry_sdk/utils.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index 2ddd81d566..5974266826 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -1427,12 +1427,6 @@ def run(self) -> None: if self._stop_event.is_set(): return - integer_configured_timeout = int(self.configured_timeout) - - # Setting up the exact integer value of configured time(in seconds) - if integer_configured_timeout < self.configured_timeout: - integer_configured_timeout = integer_configured_timeout + 1 - # Raising Exception after timeout duration is reached if self.isolation_scope is not None and self.current_scope is not None: with sentry_sdk.scope.use_isolation_scope(self.isolation_scope):