Object/Array size limit

I am trying to make multiple API calls and every call return array with 1000 elements, every element is kind of huge. I need to return ~ 7000 elements (100MB) with 7 API calls, but my code always stoped without any error on 4000 elements. Is it because I am reaching memory limit? How can I be sure ?

My code:

export const getAllFindings = async (assets: [], status: string, assetType: string) => {

    let offset = 0;
    return await fetch({}, offset);

    async function fetch(all, start) {
        const newData = await getFindingByAssetIdAndAssetType(assets, status, assetType, offset.toString());
         all = {...all, ...newData['collection']};
        return (newData.page.currentPage < newData.page.totalPages) ? await fetch(all, offset += limit.FINDINGS) : all;
    }
}


/**
 * Get findings by asset id and asset type
 *
 * @param assets
 * @param status
 * @param assetType
 * @param offset
 */
export const getFindingByAssetIdAndAssetType = async (assets: [], status: string, assetType: string, offset: string) => {
    const ids = assets.map(({value}) => value);
    const apiKey = await storage.get("api_key");

    try {
        const response = await fetch(await baseURL() + sentinelAPI.FINDINGS +
            "?asset_type=" + assetType +
            "&status=" + status +
            "&asset.id=" + ids +
            "&fields=descAndSolution&limit=" + limit.FINDINGS +
            "&offset=" + offset,

            {
                method: 'GET',
                headers: {
                    key: apiKey
                },
                timeout: 10000
            });

        if (response.status === statusCode.SUCCESS) {
            await logger("Got all findings from Sentinel", logMessageType.INFO);
        } else {
            await logger("Could not get all SAST findings from Sentinel. Response: " + await response.json(), logMessageType.WARNING);
        }

        return response.json();

    } catch (err) {
        await logger("getSASTFindingByAssetId()" + err.message.toString(), logMessageType.ERROR);
    }
}

Hi @janambroz ,
Thanks for reaching out. Here is some info about rate limits:

Regards
Magdalena

Hi @janambroz ,
Could you also give me some more details - like:

  1. On what environment is your app (dev, staging or prod)?
  2. What is your appId?
  3. Do you use tunnelling for your app?
  4. Were you looking at the UI or server side logs?
    or any other detail that might help to investigate your problem.

Regards
Magdalena