Skip to content

Sentry appears to not send exceptions that happen in async context #1136

@takeda

Description

@takeda

Environment

How do you use Sentry?
self-hosted 9.1.2

Which SDK and version?
Python 1.1.0

Steps to Reproduce

I have an AWS lambda that has multiple entry points.
I use following wrappers on the handler functions so I can use async code:

def async_entrypoint(func: Any) -> Any:  # pragma: no cover
    @wraps(func)
    def wrapper(event: Dict[str, Any], context: LambdaContext) -> Dict[str, Any]:
        sentry_sdk.init(
            "https://<snip>",
            integrations=[AwsLambdaIntegration(timeout_warning=True)],
            release=__version__,
        )
        return asyncio.run(func(event, context))

    return wrapper

It appears that functions that use this wrapper when they crash they don't seem to trigger notification in sentry. At first I had the init inside an async function and thought that maybe init() need to be called in sync code. So I moved it here, but that didn't seem to fix the issue. Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions