paulmaunders / delivery-slot-bot

A puppeteer based bot to monitor supermarket online delivery slots.
MIT License
54 stars 27 forks source link

yarn start worked first time for Tesco , but fails with " error: Auth failed." on subsequent tries #56

Open IanB999 opened 4 years ago

IanB999 commented 4 years ago

Continues to work for asda. Please kindly confirm this still works for Tesco

IanB999 commented 4 years ago

Another user has reported seeing same issue

CharlesButcher commented 4 years ago

Tesco worked for me at 1:30 this morning :O)

IanB999 commented 4 years ago

It worked for me midday and then stopped. What happens if you run

node delivery-slots.js now?

paulmaunders commented 4 years ago

It was broken for me briefly yesterday on one device, but not another. It's currently working:

Screenshot 2020-04-22 at 16 43 14

I'm not sure why we are seeing these intermittent errors...

IanB999 commented 4 years ago

[ delivery-slot-bot]$ node delivery-slots.js 1587570271262 Wed, 22 Apr 2020 15:44:31 GMT Logging in with new user session error: Auth failed. Please check details are correct in config.ini 1587570273341 Wed, 22 Apr 2020 15:44:33 GMT Logging in with new user session Opening https://groceries.asda.com/checkout/book-slot?tab=deliver No slots

This is a redhat box

CharlesButcher commented 4 years ago

OK, Tesco auth is now failing for me too.

flyfoxuk commented 4 years ago

I am getting this error too. Leaving it for 1 hour 9 mins, and running it again, worked. Subsequent runs fail auth again as above. It would seem that Tesco are detecting the logins and rate-limiting them (perhaps 1 an hour if my case is anything to go by?), whereas normal browser logins work OK anytime.

Any thoughts on how to fix?

flyfoxuk commented 4 years ago

This is the reason - by capturing the screenshot at the start of the assertLoginSuccess function, it indicates Tesco consider the browser to have failed some security checks. See attached screenshot. image

aaronwardle commented 4 years ago

Just got round to seeing this all up and getting the same error too.

aaronwardle commented 4 years ago

Tweaking the user agent in config seemed to do the trick for me :)

flyfoxuk commented 4 years ago

What did you set the agent to? I tried that earlier with no effect. Possible solution: edit src/puppeteer-utils.js to amend the getBrowser function with a delay option of a few milliseconds, or set headless to false as well:

return puppeteer.launch({//headless: false, slowMo: 50 // slow down a bit });

aaronwardle commented 4 years ago

Just popped this into config.ini

useragent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36"

aaronwardle commented 4 years ago

Amazing Thanks @paulmaunders for creating this within 15 mins of the cron setup I got alerted twice and now have a delivery slot confirmed 😀

IanB999 commented 4 years ago

fixed many thanks , and thanks for creating this

delsen-ssc commented 4 years ago

Running the browser headless fixed this for me (as suggested by @flyfoxuk 👍)

IanB999 commented 4 years ago

INFO only : Seeing quite a few timeouts this morning

Logging in with new user session Opening https://www.tesco.com/groceries/en-GB/slots/delivery/2020-04-23?slotGroup=1 [Apr 23 - 29] Navigation Timeout Exceeded: 30000ms exceeded delivery-slots.js

IanB999 commented 4 years ago

Restarted my cron this morning after I turned it off for a few days Tesco: working fine. Asda waiting for selector ".login-container .form-error" failed: timeout 30000ms exceeded

CharlesButcher commented 4 years ago

Like @IanB999, Asda has been failing for me for the last 36 hours:

Logging in with new user session
Navigation Timeout Exceeded: 30000ms exceeded

Tesco is working fine with the Mac useragent string that @aaronwardle quoted above.

andytson commented 4 years ago

Tesco never broke for me, but I'm not running 24/7, with my cron */5 5-20 * * *. I'll look at the ASDA issue later

andytson commented 4 years ago

I found the issue with asda, recaptcha preventing bot login, but it went away as soon as I logged in. I've updated the code to check for this and suggest that as an action

CharlesButcher commented 4 years ago

Thanks for that, but Asda is still failing even though I'm logged in with Firefox. @andytson, did you see a captcha the first time you signed in with your browser? I didn't.

don-tpanic commented 4 years ago

This is the reason - by capturing the screenshot at the start of the assertLoginSuccess function, it indicates Tesco consider the browser to have failed some security checks. See attached screenshot. image

Still seeing this after applied suggested fixes, any ideas? Thanks.

woodsie6 commented 4 years ago

@don-tpanic I'm having the same issue, Tesco hasn't worked for a few days for me. Auth failed. I used to get this error when it was working (albeit infrequently) however 90% of the time it would work fine. Logging in via the browser used to seem to make it work, perhaps coincidentally. I can't get this working at all for Tesco now though, even with the above suggested fixes. Even tried deleting the project folder and reinstalling. Asda seems to be working well.

IanB999 commented 4 years ago

I get issue with Asda though even after logging in.

1588100733159 - ASDA - Tue, 28 Apr 2020 19:05:33 GMT Logging in with new user session error: Auth failed. The website is thinks this could be a bot, and is showing a Recaptch check. Try logging in yourself, and this might go away [ian@centos8 delivery-slot-bot]$

CharlesButcher commented 4 years ago

Asda has just started working again after the bot has been running for many hours, with no changes to my setup. This is really very strange.

The addition of Morrison's is very welcome; is it supposed to be working yet? I keep getting Navigation Timeout Exceeded: 30000ms exceeded.

IanB999 commented 4 years ago

If you go to Morrisons website in a browser you sit in a queue for while before you get onto the site. Might work in the early hours.

On Wed, 29 Apr 2020, 18:35 CharlesButcher, notifications@github.com wrote:

Asda has just started working again after the bot has been running for many hours, with no changes to my setup. This is really very strange.

The addition of Morrison's is very welcome; is it supposed to be working yet? I keep getting Navigation Timeout Exceeded: 30000ms exceeded.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paulmaunders/delivery-slot-bot/issues/56#issuecomment-621357616, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK2FCVMUGY4ZTH7I2PPTNI3RPBQOTANCNFSM4MOI2OBQ .

CharlesButcher commented 4 years ago

Thanks @IanB999. Morrisons loads instantly for me, but I did get a reCAPTCHA which I guess explains it.

paulmaunders commented 4 years ago

I made a start on Morrisons but got a bit stuck - so I'm hoping @andytson can take a look when he gets a mo!

woodsie6 commented 4 years ago

@don-tpanic I'm having the same issue, Tesco hasn't worked for a few days for me. Auth failed. I used to get this error when it was working (albeit infrequently) however 90% of the time it would work fine. Logging in via the browser used to seem to make it work, perhaps coincidentally. I can't get this working at all for Tesco now though, even with the above suggested fixes. Even tried deleting the project folder and reinstalling. Asda seems to be working well.

Tesco back working again today, haven’t changed anything. Must be their end.