{"record":{"id":"ea2b01f50c1e8358","repo":"oven-sh/bun","slug":"missing-shortid-or-permalink","errorCode":null,"errorMessage":"Missing shortId or permalink","messagePattern":"Missing shortId or permalink","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/associate-issue-with-sentry.ts","lineNumber":42,"sourceCode":"  throw new Error(`Failed to fetch Sentry event: ${response.statusText}`);\n}\nconst json = await response.json();\nconst groupId = json?.groupId;\nif (!groupId) {\n  throw new Error(\"Missing groupId\");\n}\n\nconst issueResponse = await fetch(`https://sentry.io/api/0/issues/${groupId}/`, {\n  headers: {\n    Authorization: `Bearer ${SENTRY_AUTH_TOKEN}`,\n  },\n});\nif (!issueResponse.ok) {\n  throw new Error(`Failed to fetch Sentry issue: ${issueResponse.statusText}`);\n}\nconst { shortId, permalink } = await issueResponse.json();\nif (!shortId || !permalink) {\n  throw new Error(\"Missing shortId or permalink\");\n}\n\nconsole.log(`Sentry ID: ${shortId}`);\nconsole.log(`Sentry permalink: ${permalink}`);\n\nawait Bun.write(\"sentry-id.txt\", shortId);\nawait Bun.write(\"sentry-link.txt\", permalink);\n\nexport {};\n","sourceCodeStart":24,"sourceCodeEnd":52,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/associate-issue-with-sentry.ts#L24-L52","documentation":"The issue endpoint returned 2xx but the JSON lacks shortId or permalink, which the script needs to write sentry-id.txt and sentry-link.txt. This is a response-shape/partial-data problem rather than a transport failure.","triggerScenarios":"Sentry issue JSON missing fields the script assumes (API version drift, partial projection); field renamed so destructuring yields undefined.","commonSituations":"Sentry API changes response fields; issue in a state where shortId is not populated.","solutions":["Log the raw issue JSON to identify which field is missing or renamed","Construct the permalink fallback from a known base URL plus issue id if only shortId is missing","Update field access to the current Sentry issues API schema"],"exampleFix":"// before\nconst { shortId, permalink } = await issueResponse.json();\nif (!shortId || !permalink) throw new Error('Missing shortId or permalink');\n\n// after\nconst issue = await issueResponse.json();\nconst shortId = issue.shortId;\nconst permalink = issue.permalink ?? `https://sentry.io/organizations/4507155222364160/issues/${issue.id}/`;\nif (!shortId) throw new Error(`Missing shortId: ${JSON.stringify(issue).slice(0, 200)}`);","handlingStrategy":"type-guard","validationCode":"null","typeGuard":"interface SentryIssue { shortId?: unknown; permalink?: unknown; id?: unknown }\nfunction hasIssueFields(json: unknown): json is SentryIssue & { shortId: string } {\n  if (typeof json !== 'object' || json === null) return false;\n  const j = json as SentryIssue;\n  return typeof j.shortId === 'string' || typeof j.permalink === 'string' || typeof j.id === 'string';\n}","tryCatchPattern":null,"preventionTips":["Derive permalink from issue.id as a fallback when the field is absent","Pin expectations to the Sentry API changelog when updating the script"],"tags":["sentry","json","schema","api"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}