Closed favna closed 6 years ago
My suspicion as that this line has an empty item in the array: gameInfo.body[0].developers.concat(gameInfo.body[0].publishers)
Can you paste the response for the initial games query?
I've found the bug and it was indeed on my end. Array.prototype.concat()
put undefined
from the publishers as the second value of the array of IDs. I was under the false impression that .concat()
would filter undefined
and null
. I have ensured that this won't happen again and so can close this issue with this comment.
const companies = await gameInfo.body[0].publishers ? gameInfo.body[0].developers.concat(gameInfo.body[0].publishers) : gameInfo.body[0].developers,
developerInfo = await igdb.companies({
'ids': companies,
'fields': ['name']
});
I have been using this package for my discord bot for a while now and today someone reported getting the following error to me:
Error: HTTP Status 400 - https://api-2445582011268.apicast.io/companies/1659,?fields=name
Checking this company ID in the API Live Test I do get a result with status code 200:
All other companies I have tried return a result just fine, only company 1659 does not. Due to the error seemingly being related to the URL the request is sent to I figured I'd first create an issue here before letting it over to hoping the API gets updated to fix the issue.
I get my data from the API through the following snippet: