Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pocesar opened this issue Jun 21, 2021 · 0 comments
Open

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

pocesar opened this issue Jun 21, 2021 · 0 comments

Comments

@pocesar
Copy link

pocesar commented Jun 21, 2021

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')
    };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant