From 4d423b1cb04585510476eb793f00027bf5562029 Mon Sep 17 00:00:00 2001 From: Josh Ferge Date: Sun, 9 Nov 2025 23:38:22 -0500 Subject: [PATCH] fix(types): Add None check for projectId in installation external requests Validate projectId before querying to handle the case where it's not provided in the request. --- .../endpoints/installation_external_requests.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/sentry/sentry_apps/api/endpoints/installation_external_requests.py b/src/sentry/sentry_apps/api/endpoints/installation_external_requests.py index 3842e3c39c817e..c7a70b78ad23d9 100644 --- a/src/sentry/sentry_apps/api/endpoints/installation_external_requests.py +++ b/src/sentry/sentry_apps/api/endpoints/installation_external_requests.py @@ -21,12 +21,15 @@ class SentryAppInstallationExternalRequestsEndpoint(SentryAppInstallationBaseEnd } def get(self, request: Request, installation) -> Response: - try: - project = Project.objects.get( - id=request.GET.get("projectId"), organization_id=installation.organization_id - ) - except Project.DoesNotExist: - project = None + project_id = request.GET.get("projectId") + project = None + if project_id: + try: + project = Project.objects.get( + id=project_id, organization_id=installation.organization_id + ) + except Project.DoesNotExist: + pass kwargs = { "install": installation,