codemanki / cloudscraper

--DEPRECATED -- 🛑 🛑 Node.js library to bypass cloudflare's anti-ddos page
MIT License
599 stars 139 forks source link

Async/Await doesn't seem to work #318

Closed NinoSoles closed 4 years ago

NinoSoles commented 4 years ago

Please attempt to answer the following questions before submitting a new issue:

Please share a minimal working code snippet that reproduces the problem.

Code snippet ```js const goatRequest = async (link) => { try { let response = await cloudscraper.get(link) } catch (error) { console.log(error) } if (response.statusCode == 200){ console.log(response.body) } } ``` When I run the function it prints this in the console ``` (node:2034) UnhandledPromiseRejectionWarning: ReferenceError: response is not defined at goatRequest (node:2034) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:2034) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
codemanki commented 4 years ago

Should be fixed in 4.6.0. Please update and try again