MCPcopy Index your code
hub / github.com/simstudioai/sim / fetchLatestEvent

Function fetchLatestEvent

apps/sim/connectors/sentry/sentry.ts:353–374  ·  view source on GitHub ↗

* 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
)

Source from the content-addressed store, hash-verified

351 * and works for both sentry.io and self-hosted installs.
352 */
353async 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
376export const sentryConnector: ConnectorConfig = {
377 ...sentryConnectorMeta,

Callers 1

sentry.tsFile · 0.85

Calls 3

secureFetchWithRetryFunction · 0.90
authHeadersFunction · 0.70
warnMethod · 0.65

Tested by

no test coverage detected