diff --git a/scripts/init_serverless_sdk.py b/scripts/init_serverless_sdk.py index 57b77c9cbe..a4953ca9d7 100644 --- a/scripts/init_serverless_sdk.py +++ b/scripts/init_serverless_sdk.py @@ -5,6 +5,7 @@ Then the Handler function sstring should be replaced with 'sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler' """ + import os import sys import re diff --git a/sentry_sdk/api.py b/sentry_sdk/api.py index e78268637d..74a9c9669c 100644 --- a/sentry_sdk/api.py +++ b/sentry_sdk/api.py @@ -206,6 +206,7 @@ def flush( @hubmethod def last_event_id(): # type: () -> Optional[str] + return Hub.current.last_event_id() diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index 3e3f831b75..9ed67f0ec5 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -276,7 +276,15 @@ def scope(self): def last_event_id(self): # type: () -> Optional[str] - """Returns the last event ID.""" + """ + Returns the last event ID. + + .. deprecated:: 1.40.5 + This function is deprecated and will be removed in a future release. The functions `capture_event`, `capture_message`, and `capture_exception` return the event ID directly. + """ + logger.warning( + "Deprecated: last_event_id is deprecated. This will be removed in the future. The functions `capture_event`, `capture_message`, and `capture_exception` return the event ID directly." + ) return self._last_event_id def bind_client(