AZn5ReD / saplearninghub-pdf-downloader

Download eBook from SAP Learning Hub
MIT License
46 stars 37 forks source link

Can't connect :(` Error: Error during init #23

Open reallyallnamestaken opened 3 years ago

reallyallnamestaken commented 3 years ago

This were originally reported in issue #20 but as the reporter closed it after work-around were suggested, so I'm opening a new one. Similar symptoms as reported in #21 , however I don't see any pop-ups.

The script fail with the error below. Seem to be a timing issue. If you access the site manually this will be the point where you observe some waiting and/or a couple redirects. Same can be observed when running in debug mode on the launched Chrome browser. As a workaround I run in test mode and enter "rs" when it fails. Eventually it will go through. may take quite a few times though.


Starting script...
Going to: https://performancemanager.successfactors.eu/sf/learning?company=learninghub
Entering login: <removed>
Entering password: ***
Submiting...
Redirected to: https://accounts.sap.com/saml2/idp/usso/Learning_Hub
Can't connect :(
Error: Error during init
    at _callee3$ (/home/myuser/git/saplearninghub-pdf-downloader/src/main.js:30:11)
    at tryCatch (/home/myuser/git/saplearninghub-pdf-downloader/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/home/myuser/git/saplearninghub-pdf-downloader/node_modules/regenerator-runtime/runtime.js:274:22)
    at Generator.prototype.<computed> [as next] (/home/myuser/git/saplearninghub-pdf-downloader/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/home/myuser/git/saplearninghub-pdf-downloader/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/home/myuser/git/saplearninghub-pdf-downloader/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
[nodemon] clean exit - waiting for changes before restart
elpreto commented 3 years ago

I'm also having the same issue.

I deleted the projected and started again, I tried doing the test with debug, but I can't go through it.

elpreto commented 3 years ago

After trying around 20 times, one went through, but then I immediatly tried again and I'm getting the error again.

AZn5ReD commented 3 years ago

That’s weird. Probably some kind of navigation issue. Unfortunately, I have my own user, which has certainly a different type from yours. I can’t debug your issue unless you give me access to your account.

elpreto commented 3 years ago

I was able to download everything, it took me around 10 tries per file

reallyallnamestaken commented 3 years ago

Is there a way to log all the links or possibly a step process? things happens so quickly at the end as the program immediately close the browser so one cannot really observe the final moments.

AZn5ReD commented 3 years ago

Well, you can redirect the standard output to a file :

npm run start > log.txt

It should work on linux, don't know if that work on windows.

sag8 commented 3 years ago

There is a new reason for this error that I just came across. Password expired. If your password has expired you'll be prompted to change it before being allowed to log in. Hence changing the sequence of windows that this script expects. Hence leading to this error.

In other words, just log in to your account, normally through the browser, and make sure you don't get any unexpected popups or new windows, etc.

If you get a password reset window - reset the password. If you get a popup - Select "Don't show this again" and close the popup. If you get a popup with no option to select "Don't show this again", then raise this issue as, I think, the script will be required to be updated in that case.

mmarkvillanueva commented 2 years ago

I was able to by pass the error by editing navigation.js and by adding a 20 second delay after "await redirection(page);"

console.info("Start delay");
await new Promise(resolve => setTimeout(resolve, 20000)); // 20 sec
console.info("End delay");
donney87 commented 2 years ago

i stil

I was able to by pass the error by editing navigation.js and by adding a 20 second delay after "await redirection(page);"

console.info("Start delay");
await new Promise(resolve => setTimeout(resolve, 20000)); // 20 sec
console.info("End delay");

i still have the same issues.. even after adding 20 seconds delay.. any suggestion?