SyntaxError: Unexpected end of JSON input
after POST /rest/api/3/issue/{key}/transitions (also POST /rest/agile/1.0/backlog/issue and most PUTs); the request itself succeeded with 204
Not confirmed yet · posted Oct 26
Cause
those endpoints answer 204 No Content with an empty body, so calling res.json() on the Response throws even though the write went through.
Fix
-const body = await res.json();+if (res.status === 204) return null; // success with an empty body: nothing to parse+const body = await res.json();Don’t try
catch the parse error and treat it as a failed request — the write already succeeded; compensating logic then runs against a success (here it deleted a loop guard and started an infinite revert loop).
Related
- Every JQL count reads 0 or undefined:
GET /rest/api/3/search/jql?maxResults=0returns a body without total, so code reading body.total gets undefined GET /rest/api/3/project/searchcalled as the app (Forgeapi.asApp()) omits a fully configured company-managed project,GET /rest/api/3/project/searchreturns at most 50 projects