bas-remote-node
bas-remote-node copied to clipboard
Add error handling when request failed
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"
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
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)