google-play-scraper icon indicating copy to clipboard operation
google-play-scraper copied to clipboard

Failed to fetch similar apps "Cannot read properties of null (reading 'length')"

Open Pdaret opened this issue 1 year ago • 2 comments

  • 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')"}

Pdaret avatar Dec 30 '24 16:12 Pdaret

I fixed that by changing "===" to "==" in mappingHelpers file. You can then fix the patch with the patch-package

Image

alitsvin avatar Oct 16 '25 11:10 alitsvin

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;

archon810 avatar Oct 20 '25 01:10 archon810