Playwright with django: 502 Bad Gateway Error
My webapp doesn't work for any portion that uses playwright. Everything works in localhost (including playwright). For the deployed webapp, when trying to view the home page (no playwright), it works 100%, but when trying to use code from the library playwright, it gives me a:
502 Bad Gateway
nginx/1.18.0 (Ubuntu)
What can I do to troubleshoot this?
I tried disabling firewall, but that didn't make difference. I tried debugging by throwing an exception for each line of code. Sometimes it moves a few lines further and other times it doesn't move a few lines further. Again, only code that uses playwright will give me this error.
I'm using Django 5.1.4. Playwright is latest version.
edited: Right after doing sudo reboot, it works for a few minutes and then throws the 502 error again...
Here's some code from playwright:
try:
await page.goto('https://pantry.plentifulapp.com/login')
await expect(page.get_by_test_id("LoginForm-44")).to_be_visible(timeout=3000)
except:
content = "Plentiful is down."
return content
#Find email input and type it.
await page.get_by_test_id("LoginForm-47").click()
await page.keyboard.type(username)
#find password input, type it, and then press enter.
await page.get_by_test_id("LoginForm-53").click()
await page.keyboard.type(password)
await page.keyboard.press("Enter")