When I use the below REST API to query the issues in a specific sprint, there is an error returned: SyntaxError: Unexpected token < in JSON at position 0
Anyone knows the possible reason why certian Jira Cloud sites get that error? Thanks.
BTW, the sites may be migrared from on-premise to Cloud.
NOTE: The execution time for this API call is 20 seconds.
const response = await api
const data = await response.json();
This looks very much like HTML being returned when you’re expecting a JSON response. That why the response.json() call fails. Most of the times when I encountered something like this, it turned out to be an authentication error, but it could also be something else.
I would suggest you change the last line to something like this and check what’s actually being returned:
const data = await response.text();
Without the exact error message, there really isn’t a way to know for sure what’s going on. However, if I were to venture a guess, then maybe the sites that show the error do not include Jira Software? If I remember correctly, Jira Work Management does not include Sprints.
@veloti & @YY1 if you’re seeing this issue for only a subset of Jira Cloud sites that your app is installed into, or you’re otherwise unable to resolve the issue, please raise an support request under the Report a bug category in our ECOHELP service desk with more specifics about your apps & Jira sites and our Developer Support team will endeavour to assist you.