google-play-scraper
google-play-scraper copied to clipboard
Failed to fetch similar apps "Cannot read properties of null (reading 'length')"
- Operating System: Ubuntu24
- Node version: latest (also tested on node version 18)
- google-play-scraper version: latest release
Description:
i've use this library to fetch similar apps, but in some cases its cannot scrape similar apps
Example code:
try {
const similarApps = await gplay.similar({ appId, fullDetail: true });
res.json(similarApps);
} catch (error) {
res.status(500).json({ error: 'Failed to fetch similar apps', details: error.message });
}
Error message:
{"error":"Failed to fetch similar apps","details":"Cannot read properties of null (reading 'length')"}
I fixed that by changing "===" to "==" in mappingHelpers file. You can then fix the patch with the patch-package
It's also straight up failing to get a foreign app, for example https://play.google.com/store/apps/details?id=com.kobe.cacaushow&gl=br.
@facundoolano Perhaps this fix can be fast tracked to 10.0.2? It breaks a lot of stuff.
Claude suggested this:
// Before:
if (searchArray === null || searchArray.length === 0) return categories;
// After:
if (searchArray === null || searchArray === undefined || searchArray.length === 0) return categories;