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

Add error handling when request failed #16

Open
keung227 opened this issue Jun 20, 2023 · 2 comments
Open

Add error handling when request failed #16

keung227 opened this issue Jun 20, 2023 · 2 comments

Comments

@keung227
Copy link

keung227 commented Jun 20, 2023

undefined:1
<html>
^

SyntaxError: Unexpected token < in JSON at position 0
    at IncomingMessage.<anonymous> (my_program_path\node_modules\bas-remote-node\src\utils.js:29:20)

There are some issues which force close my program when fetching fingerprint using "puppeteer-with-fingerprints"

@Firegarden
Copy link

I figured out what this is related to a dns resolution or ip address end point connectivity - I think the end point is slow.

The issue seems to be related to an HTML or error message being returned rather than the actually data expected.

I came up with my own patch for the code which seems to work well.

see attached file engine.js.txt

Note this fix is hardcoded to only work with the current version

My approach you will see in engine.js is to look at the version of the url being requested at instead of waiting to get the simple json data back I have just hard coded the json response data - this seems to work and maybe you want to use an appraoch like this as the endpoint being hit in the code is clearly getting bogged down - this approach to fixing the code will also lower the number of requests to the server making it less likely to happen.

Thank you

@dmitryp-rebel
Copy link

Also catch same issue continuously:

Uncaught exception
SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at IncomingMessage.<anonymous> (C:\bots\bot-amazon-180-1\node_modules\bas-remote-node\src\services\utils.js:14:20)
    at IncomingMessage.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1368:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants