From c25225c6924c705e7c1fbc260158b5b8dfe44b17 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 7 Dec 2023 12:49:03 -0500 Subject: [PATCH] Build fixes (#65) * Switch to building psycopg2. The binary wheels don't work well with docker + apple silicon * Update issue URL to work with multi-region * Fix test * Fix lint --- backend-py/Dockerfile | 3 +++ backend-py/requirements.txt | 2 +- backend-py/src/api/endpoints/items.py | 4 +++- backend-py/tests/api/items/test_index.py | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/backend-py/Dockerfile b/backend-py/Dockerfile index 72ff37ac..6df05059 100644 --- a/backend-py/Dockerfile +++ b/backend-py/Dockerfile @@ -1,5 +1,8 @@ FROM python:3.9-slim as backend-py +RUN apt update && \ + apt install -y python3-dev gcc libpq-dev + WORKDIR /backend-py # Re-create the requirements layer if the requirements change COPY requirements.txt . diff --git a/backend-py/requirements.txt b/backend-py/requirements.txt index 9df2a7c4..5a5629c5 100644 --- a/backend-py/requirements.txt +++ b/backend-py/requirements.txt @@ -19,7 +19,7 @@ packaging==21.3 pathspec==0.9.0 platformdirs==2.5.1 pluggy==1.0.0 -psycopg2-binary==2.9.3 +psycopg2==2.9.3 py==1.11.0 pycodestyle==2.8.0 pyflakes==2.4.0 diff --git a/backend-py/src/api/endpoints/items.py b/backend-py/src/api/endpoints/items.py index 99a8eb55..ae305f6b 100644 --- a/backend-py/src/api/endpoints/items.py +++ b/backend-py/src/api/endpoints/items.py @@ -22,7 +22,9 @@ def add_sentry_api_data( for item in items: if item["sentryId"]: # Use the numerical ID to fetch the short ID - sentry_data = sentry.get(f"/issues/{item['sentryId']}/") + sentry_data = sentry.get( + f"/organizations/{organization.external_slug}/issues/{item['sentryId']}/" + ) short_id = sentry_data.json().get("shortId") # Replace the numerical ID with the short ID if short_id: diff --git a/backend-py/tests/api/items/test_index.py b/backend-py/tests/api/items/test_index.py index 10e5f1e3..40975b62 100644 --- a/backend-py/tests/api/items/test_index.py +++ b/backend-py/tests/api/items/test_index.py @@ -41,7 +41,7 @@ def test_index_with_sentry_api(self): responses.add( responses.GET, - f"{SENTRY_URL}/api/0/issues/{sentry_id}/", + f"{SENTRY_URL}/api/0/organizations/organization/issues/{sentry_id}/", body=json.dumps({"shortId": short_id}), ) @@ -57,7 +57,7 @@ def test_index_with_failing_sentry_api(self): responses.add( responses.GET, - f"{SENTRY_URL}/api/0/issues/{sentry_id}/", + f"{SENTRY_URL}/api/0/organizations/organization/issues/{sentry_id}/", body=json.dumps({}), )