writehat icon indicating copy to clipboard operation
writehat copied to clipboard

Unable to generate the PDF

Open rajesh457 opened this issue 1 year ago • 7 comments

I'm unable to generate the PDF, tried everything at my own, but it keep giving 500 Error image

rajesh457 avatar Dec 03 '24 08:12 rajesh457

This error on Terminal image

rajesh457 avatar Dec 03 '24 09:12 rajesh457

If you have yet to do so, i would switch to the github-dev branch, since that is more up to date. This looks like an issue with the selenium server, an issue which I had also encountered in the past. Can you do the following steps and get back to me on the results?

  1. switch to github-dev branch
  2. rebuild the docker image, ensuring that the correct docker image versions are being used
  3. start the server and try to generate a pdf again

Just in case, i recommend making a backup of any existing mysql data before rebuilding, in case of mysql version changes messing things up. After doing that, if it still errors out, can you post an image of the stacktrace?

TMDeal avatar Dec 03 '24 17:12 TMDeal

Hi @TMDeal, For some reason, Still getting the same error.

I've cloned the github-dev branch using the following cmd on a fresh DO VPS, having 8GB RAM, 2vCPU

git clone --branch github-dev https://github.com/blacklanternsecurity/writehat.git

and getting the same error image

image

rajesh457 avatar Dec 04 '24 08:12 rajesh457

Hi @TMDeal,

Please note that, it gives different error each time to add some random URLs to the ALLOWED_HOSTS

  • image

  • image

After adding the shown hosts, it gives a new host to add in ALLOWED_HOSTS image

rajesh457 avatar Dec 04 '24 08:12 rajesh457

Im not too sure how those extra hosts have showed up in the logs. From what i am seeing in there, it looks like a request is being made to the writehat web server for a php file?

image

I am going to see if i can work this issue out on my end and see if there is something I am missing. Also, can you post some more log messages from the chrome container? If not, I understand, I was a bit late in responding to this and you may no longer have the logs around.

TMDeal avatar Dec 11 '24 15:12 TMDeal

from my tests, I also got an error when browsing to the generate pdf page, I was able to fix it by downgrading the version of selenium installed to 4.8.2 by pinning it in requirements.txt. Can you try adding that version pin into requirements.txt, rebuilding the containers, and then trying to render the pdf again? It may not have had anything to do with the allowed hosts

TMDeal avatar Dec 11 '24 16:12 TMDeal

Hi @TMDeal, Thankyou so much

selenium installed to 4.8.2 by pinning it in requirements.txt

Worked like a charm, Thanks for your time :)

rajesh457 avatar Dec 21 '24 11:12 rajesh457