oven-sh/bun · error · Error
Missing shortId or permalink
Error message
Missing shortId or permalink
What it means
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.
Source
Thrown at scripts/associate-issue-with-sentry.ts:42
throw new Error(`Failed to fetch Sentry event: ${response.statusText}`);
}
const json = await response.json();
const groupId = json?.groupId;
if (!groupId) {
throw new Error("Missing groupId");
}
const issueResponse = await fetch(`https://sentry.io/api/0/issues/${groupId}/`, {
headers: {
Authorization: `Bearer ${SENTRY_AUTH_TOKEN}`,
},
});
if (!issueResponse.ok) {
throw new Error(`Failed to fetch Sentry issue: ${issueResponse.statusText}`);
}
const { shortId, permalink } = await issueResponse.json();
if (!shortId || !permalink) {
throw new Error("Missing shortId or permalink");
}
console.log(`Sentry ID: ${shortId}`);
console.log(`Sentry permalink: ${permalink}`);
await Bun.write("sentry-id.txt", shortId);
await Bun.write("sentry-link.txt", permalink);
export {};
View on GitHub (pinned to 8c5296ac45)
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
Example fix
// before
const { shortId, permalink } = await issueResponse.json();
if (!shortId || !permalink) throw new Error('Missing shortId or permalink');
// after
const issue = await issueResponse.json();
const shortId = issue.shortId;
const permalink = issue.permalink ?? `https://sentry.io/organizations/4507155222364160/issues/${issue.id}/`;
if (!shortId) throw new Error(`Missing shortId: ${JSON.stringify(issue).slice(0, 200)}`); Defensive patterns
Strategy: type-guard
Validate before calling
null
Type guard
interface SentryIssue { shortId?: unknown; permalink?: unknown; id?: unknown }
function hasIssueFields(json: unknown): json is SentryIssue & { shortId: string } {
if (typeof json !== 'object' || json === null) return false;
const j = json as SentryIssue;
return typeof j.shortId === 'string' || typeof j.permalink === 'string' || typeof j.id === 'string';
} Prevention
- Derive permalink from issue.id as a fallback when the field is absent
- Pin expectations to the Sentry API changelog when updating the script
When it happens
Trigger: Sentry issue JSON missing fields the script assumes (API version drift, partial projection); field renamed so destructuring yields undefined.
Common situations: Sentry API changes response fields; issue in a state where shortId is not populated.
Related errors
- Missing groupId
- Failed to fetch Sentry event: ${response.statusText}
- Failed to fetch Sentry issue: ${issueResponse.statusText}
- MissingAdvisoriesField
- InvalidAdvisoriesFormat
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/ea2b01f50c1e8358.
Report an issue: GitHub.