* Fetches the latest event for an issue. Returns null when the issue has no events or the * request fails, so the document still syncs with its list-level summary. * * Uses the organization-scoped event endpoint * `/api/0/organizations/{org}/issues/{id}/events/latest/`, which is the documented p
( apiBase: string, organization: string, accessToken: string, issueId: string )
| 351 | * and works for both sentry.io and self-hosted installs. |
| 352 | */ |
| 353 | async function fetchLatestEvent( |
| 354 | apiBase: string, |
| 355 | organization: string, |
| 356 | accessToken: string, |
| 357 | issueId: string |
| 358 | ): Promise<SentryEvent | null> { |
| 359 | const url = `${apiBase}/organizations/${encodeURIComponent(organization)}/issues/${encodeURIComponent(issueId)}/events/latest/` |
| 360 | |
| 361 | const response = await secureFetchWithRetry(url, { |
| 362 | method: 'GET', |
| 363 | headers: authHeaders(accessToken), |
| 364 | }) |
| 365 | |
| 366 | if (!response.ok) { |
| 367 | if (response.status !== 404) { |
| 368 | logger.warn('Failed to fetch latest Sentry event', { issueId, status: response.status }) |
| 369 | } |
| 370 | return null |
| 371 | } |
| 372 | |
| 373 | return (await response.json()) as SentryEvent |
| 374 | } |
| 375 | |
| 376 | export const sentryConnector: ConnectorConfig = { |
| 377 | ...sentryConnectorMeta, |
no test coverage detected