druv5319 / Sneaks-API

A StockX, FlightClub, Goat, and Stadium Goods API all in one. This sneaker API allows users to search sneakers and track and compare prices while providing additional info such as product links and images
448 stars 118 forks source link

HTTPError: Response code 400 (Bad Request) #20

Closed th13n-h4ck3r closed 3 years ago

th13n-h4ck3r commented 3 years ago

Usage I'm not sure why, but I just installed this npm package, and used the example provided: sneaks.getProducts("Yeezy Cinder", function(err, products){ console.log(products) });

Problem However, I keep on getting the same error of: `(node:19940) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'styleID' of undefined at Object.getProductsAndInfo (\node_modules\sneaks-api\scrapers\stockx-scraper.js:66:87) at processTicksAndRejections (internal/process/task_queues.js:97:5)

/internal/process/warning.js:32 (node:19940) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) /internal/process/warning.js:32 (node:19940) [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. ` **Attempt to figure out why** So I went to the directory of the error which is `\node_modules\sneaks-api\scrapers\stockx-scraper.js:66:87` and added a new line of code at line 65 to `console.log(error)` before it throws the error. **The actual problem** So I ran the code to see what was the actual error, then I found this `HTTPError: Response code 400 (Bad Request) at Request. (node_modules\got\dist\source\as-promise\index.js:117:42) at processTicksAndRejections (internal/process/task_queues.js:97:5) {name: 'HTTPError', code: undefined, timings: {…}, stack: 'HTTPError: Response code 400 (Bad Request) …ctions (internal/process/task_queues.js:97:5)', message: 'Response code 400 (Bad Request)', …} code:undefined message:'Response code 400 (Bad Request)' name:'HTTPError' options:{method: 'POST', retry: {…}, headers: {…}, hooks: {…}, cache: undefined, …} request:Request {_readableState: ReadableState, readable: false, _events: {…}, _eventsCount: 16, _maxListeners: undefined, …} response:IncomingMessage {_readableState: ReadableState, readable: false, _events: {…}, _eventsCount: 4, _maxListeners: undefined, …} stack:'HTTPError: Response code 400 (Bad Request)\n at Request. node_modules\\got\\dist\\source\\as-promise\\index.js:117:42)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)' timings:{start: 1618015392952, socket: 1618015392953, lookup: 1618015392954, connect: 1618015393101, secureConnect: 1618015393297, …} __proto__:RequestError` **Images** [Here](https://i.imgur.com/jJ3AqgQ.png) is a screenshot of the error
sam-muldrow commented 3 years ago

I am also running into this issue

gulkaran commented 3 years ago

Currently also my issue!