robertjdominguez / ez-resy

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

Type Error #4

Closed Xeus2203 closed 3 months ago

Xeus2203 commented 3 months ago

The bot works for me once but when its time to actually book, it shows type error. Also it would take 5-10secs before showing that error: C:\Users\Prathamesh Parikh\Downloads\ez-resy-main\ez-resy-main>npm run start:today

resy@1.0.0 start:today node --env-file=.env index.js

JWT will expire on Wed Jul 31 2024 20:38:48 GMT+0530 (India Standard Time) TypeError: Cannot read properties of undefined (reading 'venue') at fetchDataAndParseSlots (file:///C:/Users/Prathamesh%20Parikh/Downloads/ez-resy-main/ez-resy-main/utils/bookingLogic.js:29:71) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///C:/Users/Prathamesh%20Parikh/Downloads/ez-resy-main/ez-resy-main/index.js:15:17

screenshot attached Screenshot 2024-06-16 213920 Screenshot 2024-06-16 213920

robertjdominguez commented 3 months ago

This typically results from an environment variables being unreadable. Can you share the key-value you added?

Xeus2203 commented 3 months ago

This typically results from an environment variables being unreadable. Can you share the key-value you added?

Sure I am assuming you mean the env file. Here they are: VENUE_ID=76033 DATE=2024-06-29 EARLIEST=21:00 LATEST=22:00 PARTY_SIZE=2 PAYMENT_ID=23913288 AUTH_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJleHAiOjE3MjIzNDgyNDcsInVpZCI6NTA1NzczNDcsImd0IjoiY29uc3VtZXIiLCJncyI6W10sImxhbmciOiJlbi11cyIsImV4dHJhIjp7Imd1ZXN0X2lkIjoxNTk2MzExMjV9fQ.AWlmATqeG5Y4oWuCyX9ZudxO5wR8kwjpt9unFuE3-XR77vfUA447xRrLbBADsRrWmZenNavllwucLeU9cr6h71eEAGaC_j58hpVhmva48sTAVELWtxeojkKutKROx6w0aHLOFUnvb-vmollpjkJnbrBMSehwth3pG4niLmK30oCie6yF

The env file above worked as I just wanted to check if it was working. When I changed the venue id and the dates but auth token was the same, then it showed the initial type error.

I edit the env file via notepad++ and then write the npm run start:today command in the cmd. Am im doing something wrong.

Xeus2203 commented 3 months ago

I think i got it. Following is what happens: For example Date in env: 2024-07-06 (reservation open online, slots available or not) bot works fine Date in env: 2024-07-07 (reservation not open yet) here it shows that error i have attached screenshot

Screenshot 2024-06-17 at 10 06 06 AM

socialmediaguy commented 3 months ago

Same error. Maybe resy blocked the bot?

robertjdominguez commented 3 months ago

Date in env: 2024-07-07 (reservation not open yet) here it shows that error

@Xeus2203 — exactly: if reservations are not yet open, the application will error out. It can't reserve what isn't yet available. I'll open a fix to clarify this.

Same error. Maybe resy blocked the bot?

@socialmediaguy — this is doubtful, as there wouldn't be any telemetry and people are using their own credentials.

socialmediaguy commented 3 months ago

Thanks @robertjdominguez Not sure if it is the right place to post (i'll delete if not) but how difficult would it be to amend this to work for opentable and sevenrooms?

robertjdominguez commented 3 months ago

These are completely different APIs with different data structures, IDs for venues, etc. This is only meant to work with Resy. However, you could very well use this repository as inspiration and attempt to build out a workflow that mimics this one's outcome, only with specific steps related to those other services 🚀

socialmediaguy commented 3 months ago

thanks @robertjdominguez
The other thing is that i got the same error even when the reservations opened, intil like 10 mins after but then all were gone. I think it would be good if the script can sleep and be timed to kick off at a certain time and then sent a set number of requests until one is succesful. i.e gets to the point where it find a reservation available. Thanks

robertjdominguez commented 3 months ago

That implementation detail is completely up to you. You can use a cron job, GitHub Action, Rube Goldberg machine, etc.

robertjdominguez commented 3 months ago

I pushed this commit that adds explicit messaging and loads env vars differently.

socialmediaguy commented 3 months ago

I pushed this commit that adds explicit messaging and loads env vars differently.

Legend!

Xeus2203 commented 3 months ago

@robertjdominguez What could be the reason for this error? Screenshot attached: Screenshot 2024-06-20 at 9 33 32 AM

robertjdominguez commented 3 months ago

It could be that someone was faster? The application works by finding all available reservations and then attempting to book the optimal one based on your preferences. This doesn't mean that it claims the slots before the reservation is confirmed; there's no queuing in Resy's system...first come, first served.

For popular restaurants, such as this one, it's truly a matter of being as quick as possible. This is one reason it's recommended to run this on something like a cron job so that you don't have to be at the ready when reservations come online.

Xeus2203 commented 3 months ago

@robertjdominguez Thank you! I really appreciate the explanation.