Skip to content

No more last_event_id #3049

@maltalk

Description

@maltalk

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.1.0

Steps to Reproduce

https://develop.sentry.dev/sdk/features/#retrieve-last-event-id
The method last_event_id does not exist anymore. I understand that's been deprecated but, how are we supposed to show the event_id to the user now?
from sentry_sdk import last_event_id

Expected Result

Be able to get the last event id from a non controlled exception and show it to the final user.
In django for example, the recommended way was this:

from sentry_sdk import last_event_id

from django.shortcuts import render


def custom_handler500(request):
    context = {
        "request": request,
        "title": "Error 500",
        "last_event_id": last_event_id(),
    }
    template_name = "500.html"
    return render(request, template_name, context, status=500)

Actual Result

ImportError: cannot import name 'last_event_id' from 'sentry_sdk' (/app/.venv/lib/python3.11/site-packages/sentry_sdk/__init__.py)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions