Skip to content

Warn about trying to output DOM nodes / complex objects #139

@pocesar

Description

@pocesar

Happens more often with web-scraper, some people try to return a jQuery instance (like $('selector') instead of $('selector').text()) or a DOM node on the return object, and it either fails with Error: Evaluation failed: RangeError: Maximum call stack size exceeded, get stuck forever (up until the handle page timeout) or the dataset endpoint fails with the humongous JSON generated with a lot of circular references.

sample run https://my.apify.com/view/runs/ysnZZXg9qxp2Plp24

{"level":"WARNING","msg":"Retry failed 4 times and will be repeated in 14623ms","originalError":"API request failed on retry number 5","errorDetails":{"url":"http://xxxx/v2/datasets/xxxx/items","method":"POST","qs":{"token":"*********"},"hasBody":true,"statusCode":502,"iteration":5}}

minimal repro code:

async function pageFunction(context) {
    // This statement works as a breakpoint when you're trying to debug your code. Works only with Run mode: DEVELOPMENT!
    // debugger; 

    const $ = context.jQuery;

    return {
        url: context.request.url,
        body: $('body')
    };
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions