Skip to content

Commit 4920c86

Browse files
fix: used the new endpoint instead of the deprecated one
1 parent 6c266f1 commit 4920c86

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/lib/api-client.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
import {
12+
listAnOrganization_sIssues,
1213
listAnOrganization_sProjects,
1314
listAProject_sClientKeys,
1415
queryExploreEventsInTableFormat,
@@ -680,6 +681,7 @@ export function getProjectKeys(
680681

681682
/**
682683
* List issues for a project.
684+
* Uses the org-scoped endpoint (the project-scoped one is deprecated).
683685
* Uses region-aware routing for multi-region support.
684686
*/
685687
export function listIssues(
@@ -689,32 +691,32 @@ export function listIssues(
689691
query?: string;
690692
cursor?: string;
691693
limit?: number;
692-
sort?: "date" | "new" | "priority" | "freq" | "user";
694+
sort?: "date" | "new" | "freq" | "user";
693695
statsPeriod?: string;
694696
} = {}
695697
): Promise<SentryIssue[]> {
696-
return withHttpSpan(
697-
"GET",
698-
`/projects/${orgSlug}/${projectSlug}/issues/`,
699-
async () => {
700-
const regionUrl = await resolveOrgRegion(orgSlug);
698+
return withHttpSpan("GET", `/organizations/${orgSlug}/issues/`, async () => {
699+
const config = await getOrgSdkConfig(orgSlug);
701700

702-
// Use raw request: the SDK type doesn't support limit/sort params
703-
return apiRequestToRegion<SentryIssue[]>(
704-
regionUrl,
705-
`/projects/${orgSlug}/${projectSlug}/issues/`,
706-
{
707-
params: {
708-
query: options.query,
709-
cursor: options.cursor,
710-
limit: options.limit,
711-
sort: options.sort,
712-
statsPeriod: options.statsPeriod,
713-
},
714-
}
715-
);
716-
}
717-
);
701+
// Build query with project filter: "project:{slug}" prefix
702+
const projectFilter = `project:${projectSlug}`;
703+
const fullQuery = [projectFilter, options.query].filter(Boolean).join(" ");
704+
705+
const result = await listAnOrganization_sIssues({
706+
...config,
707+
path: { organization_id_or_slug: orgSlug },
708+
query: {
709+
query: fullQuery,
710+
cursor: options.cursor,
711+
limit: options.limit,
712+
sort: options.sort,
713+
statsPeriod: options.statsPeriod,
714+
},
715+
});
716+
717+
const data = unwrapResult(result, "Failed to list issues");
718+
return data as unknown as SentryIssue[];
719+
});
718720
}
719721

720722
/**

0 commit comments

Comments
 (0)