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

Throwing string (or non-Error) in requestHandler crashes the whole crawler #1636

Closed
1 task
metalwarrior665 opened this issue Oct 27, 2022 · 0 comments · Fixed by #1652
Closed
1 task

Throwing string (or non-Error) in requestHandler crashes the whole crawler #1636

metalwarrior665 opened this issue Oct 27, 2022 · 0 comments · Fixed by #1652
Assignees
Labels
bug Something isn't working.

Comments

@metalwarrior665
Copy link
Member

Which package is this bug report for? If unsure which one to select, leave blank

No response

Issue description

This is a new issue with 3.1. We expect the message property on the error, this has to be done much more fool-proof way.

https://console.apify.com/view/runs/iqSpbKgEiqR9v78Tj

2022-10-27T18:49:02.198Z /usr/src/app/node_modules/@crawlee/utils/internals/error_tracker.js:149
2022-10-27T18:49:02.200Z         const newLineIndex = message.indexOf('\n');
2022-10-27T18:49:02.201Z                                      ^
2022-10-27T18:49:02.202Z 
2022-10-27T18:49:02.203Z TypeError: Cannot read properties of undefined (reading 'indexOf')
2022-10-27T18:49:02.205Z     at getErrorMessageGroup (/usr/src/app/node_modules/@crawlee/utils/internals/error_tracker.js:149:38)
2022-10-27T18:49:02.206Z     at ErrorTracker.add (/usr/src/app/node_modules/@crawlee/utils/internals/error_tracker.js:229:21)
2022-10-27T18:49:02.208Z     at BasicCrawler._requestFunctionErrorHandler (/usr/src/app/node_modules/@crawlee/basic/internals/basic-crawler.js:717:42)
2022-10-27T18:49:02.209Z     at /usr/src/app/node_modules/@crawlee/basic/internals/basic-crawler.js:650:69
2022-10-27T18:49:02.210Z     at wrap (/usr/src/app/node_modules/@apify/timeout/index.js:52:27)
2022-10-27T18:49:02.211Z     at /usr/src/app/node_modules/@apify/timeout/index.js:66:7
2022-10-27T18:49:02.213Z     at AsyncLocalStorage.run (node:async_hooks:330:14)
2022-10-27T18:49:02.214Z     at /usr/src/app/node_modules/@apify/timeout/index.js:65:13
2022-10-27T18:49:02.216Z     at new Promise (<anonymous>)
2022-10-27T18:49:02.217Z     at addTimeoutToPromise (/usr/src/app/node_modules/@apify/timeout/index.js:59:10)

Code sample

const startUrls = ['https://apify.com'];

const crawler = new BasicCrawler({
    requestHandler: async () => {
        throw 'test'
    },
});

await crawler.run(startUrls);

Package version

3.1

Node.js version

16.17

Operating system

No response

Apify platform

  • Tick me if you encountered this issue on the Apify platform

Priority this issue should have

High (immediate attention needed)

I have tested this on the next release

No response

Other context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants