When running Puppeteer on Heroku, page.goto exhibits different behaviors across browsers, causing loss of login credentials in some cases. For example:
hey, i had this issue too. i solved it by adding a short delay after clicking login, so the creds got saved properly. may be a race conditon, try that tweak.
Based on my experience, I found that when using Puppeteer on Heroku, the issue sometimes lies in the asynchronous nature of the page events and the environment differences between browsers. In one project I worked on, I had to tweak the navigation timing by not only relying on networkidle0 but also by explicitly waiting for certain DOM elements to be visible before proceeding. I refined the wait criteria by using page.waitForSelector after login and added a short delay to ensure that all tokens and credentials were properly saved. This method helped stabilize the behavior across different browser instances on Heroku.
In my experience, the key to resolving inconsistent behavior in Puppeteer on Heroku was to examine the entire environment setup. I found that simply adding delays wasn’t a complete fix. I experimented with extending timeouts for both page navigation and element visibility, which helped to mitigate any issues arising from network delays or resource constraints on Heroku. Furthermore, I incorporated detailed logging to pinpoint exactly where the credentials were being lost. Adjusting the launch options and verifying that all browser instances were started with identical configurations also played a significant role in stabilizing the process.