robertjdominguez / ez-resy

Quickly and easily snipe reservations with just a bit of configuration.
15 stars 9 forks source link

Getting error 500 when trying to make booking #6

Closed socialmediaguy closed 4 months ago

socialmediaguy commented 4 months ago

Hi,

Getting the below error now when using the bot but I am able to manually make a booking on the website.

Checking for reservations at Semma on Monday, July 8 for 2 people... There are 6 slots available Booking a prime slot at 9:00 PM in the Dining Room! AxiosError: Request failed with status code 500 at settle (file:///C:/Users/user1/Documents/user/ezresy/node_modules/axios/lib/core/settle.js:19:12) at IncomingMessage.handleStreamEnd (file:///C:/Users/user1/Documents/user/ezresy/node_modules/axios/lib/adapters/http.js:589:11) at IncomingMessage.emit (node:events:531:35) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) at Axios.request (file:///C:/Users/user1/Documents/user/ezresy/node_modules/axios/lib/core/Axios.js:45:41) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async getBookingConfig (file:///C:/Users/user1/Documents/user/ezresy/utils/bookingLogic.js:67:22) at async file:///C:/Users/user1/Documents/user/ezresy/index.js:18:23 { code: 'ERR_BAD_RESPONSE', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http', 'fetch' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: Infinity, env: { FormData: [Function], Blob: [class Blob] }, validateStatus: [Function: validateStatus], headers: Object [AxiosHeaders] { Accept: 'application/json, text/plain, /', 'Content-Type': undefined, authority: 'api.resy.com', ... ... ... res: IncomingMessage { _events: [Object], _readableState: [ReadableState], _maxListeners: undefined, socket: null, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], joinDuplicateHeaders: undefined, aborted: false, upgrade: false, url: '', method: null, statusCode: 500, statusMessage: 'Internal Server Error', client: [TLSSocket], _consuming: false, _dumped: false, req: [Circular *1], _eventsCount: 4,

Have tested on a few restaurants with available slot and I am getting the same now

robertjdominguez commented 4 months ago

Given the logging shows success up until the point of trying to book the reservation, I'm guessing you haven't accurately referenced the payment information. Try this solution and see if it sorts you.

socialmediaguy commented 4 months ago

I think the payment information if ok, I have double checked. I used the same info to make a book yesterday and have nto changed the payment ID. Today I am having an issue.

robertjdominguez commented 4 months ago

Again, the error (at async getBookingConfig (file:///C:/Users/user1/Documents/user/ezresy/utils/bookingLogic.js:67:22)) points to this section of the code:

  formData.append(
    "struct_payment_method",
    JSON.stringify({ id: process.env.PAYMENT_ID }),
  );
socialmediaguy commented 4 months ago

Ok you are right, sorry. Yesterday it worked because that booking didn't need to take a payment

socialmediaguy commented 4 months ago

btw is there any way to make it faster? For a hard to get restaurant, seems to sell out within seconds. As soon as bto runs, it says 0 slots for the newly released date

robertjdominguez commented 4 months ago

To a degree, sure.

There's certain variability that's not controllable (e.g., network hops and multiple requests having to go to and from the client <> API).

However, different runtimes can be utilized that are faster than Node (e.g., Bun). I imagine the effects would be trivial given the other identified constraints above.

This is again why it's recommended to run this on a cron job or similar process.

socialmediaguy commented 4 months ago

ah yes i am running on cronjob and have several runs within a few seconds, still can never seem to get a res at the hard t get places. so you don't think Bun will make much diff?

socialmediaguy commented 4 months ago

also btw I am getting the similar error again. payment ID is correct, i double checked. Here is the error:

AxiosError: Request failed with status code 500 at settle (file:///C:/Users/user1/Documents/user/ezresy/node_modules/axios/lib/core/settle.js:19:12) at IncomingMessage.handleStreamEnd (file:///C:/Users/user1/Documents/user/ezresy/node_modules/axios/lib/adapters/http.js:589:11) at IncomingMessage.emit (node:events:531:35) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) at Axios.request (file:///C:/Users/user1/Documents/user/ezresy/node_modules/axios/lib/core/Axios.js:45:41) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async getBookingConfig (file:///C:/Users/user1/Documents/user/ezresy/utils/bookingLogic.js:67:22) at async file:///C:/Users/user1/Documents/user/Business/ezresy/index.js:18:23 { code: 'ERR_BAD_RESPONSE',

socialmediaguy commented 4 months ago

hi @robertjdominguez Quick question. I have been trying to amend the script to be able to book on behalf of someone else using the concierge option in resy but not having much luck. Failing to generate the right structure for the message, althought i think i nearly have this sorted. The issue is, you can;t used a saved card and need to submit new card details. ~Question is, have you tried this and do you think it is possible?

robertjdominguez commented 4 months ago

@socialmediaguy - I haven't tried this.

However, you should be able to follow the network requests in the browser when adding a new card, seeing what the response is, and then abstract that process to utilize this as a new step in the sequence.

socialmediaguy commented 4 months ago

Yeh I tried this but I i am getting stuck on the part where you submit card details, as these are added, submited to stripe and a payment token is received and then you book.

socialmediaguy commented 4 months ago

oh and there is a capctha too

socialmediaguy commented 4 months ago

@robertjdominguez So I don't think it was a pyament issue for me. If i retry with a VPN it works.

socialmediaguy commented 4 months ago

Hey @robertjdominguez question. Is it possible to send a request for the timeslot i want and not request all the slots? Or is this not possible because you need to find the token ID for the slot?

robertjdominguez commented 4 months ago

@socialmediaguy You can simply set the range for EARLIEST and LATEST times in your env file.