Reactive-Resume: [BUG] PDF Download not working
Describe the bug PDF Download gives 500 Internal Server Error
To Reproduce
- Create new resume (I called it test)
- Click the download PDF button
- The network console shows a 500 error after awhile.
Expected behavior PDF should be created and downloaded
Additional context
[Nest] 42 - 03/16/2022, 1:44:41 PM ERROR [ExceptionsHandler] page.waitForSelector: Timeout 30000ms exceeded.
--
Wed, Mar 16 2022 8:44:41 am | =========================== logs ===========================
Wed, Mar 16 2022 8:44:41 am | waiting for selector "html.wf-active" to be visible
Wed, Mar 16 2022 8:44:41 am | ============================================================
Wed, Mar 16 2022 8:44:41 am | page.waitForSelector: Timeout 30000ms exceeded.
Wed, Mar 16 2022 8:44:41 am | =========================== logs ===========================
Wed, Mar 16 2022 8:44:41 am | waiting for selector "html.wf-active" to be visible
Wed, Mar 16 2022 8:44:41 am | ============================================================
Wed, Mar 16 2022 8:44:41 am | at PrinterService.printAsPdf (/app/server/dist/printer/printer.service.js:40:20)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 57 (11 by maintainers)
It seems there may be multiple reasons people encounter this, but I found a solution to my issue. It had to do with how my reverse proxy was configured and the fact that I was trying to serve them off of the same port of the same domain. The issue was the server calls its public URL to its own
printer
endpoint differently than the endpoint to return a resume to the browser. So it must be able to resolve its own traffic back to itself locally using the same DNS & routing as over a public network.In my Docker Compose file, I have it configured to serve the client from port
3180
and the server from port3190
.My URL
env
variables are configured like this:PUBLIC_URL=https://<sub>.<domain>.com/
PUBLIC_SERVER_URL=https://<sub>.<domain>.com/api
These variables are identical between the server and client containers.
In my Nginx reverse proxy, I configured traffic to
<sub>.<domain>.com
to be directed to the client onhttp://<docker_host>:3180
, but then I needed to add a custom location to the same Nginx config specifically forhttps://<sub>.<domain>.com/api/
and forward all traffic to/api
tohttp://<docker_host>:3190/
without the/api
suffix. Here is what that extra rule looks like:If you’re using Nginx Proxy Manager, this is what the extra config looks like:
I’ve also had 500 error when trying to generate PDF on local with docker. I’ve checked some docker logs from
server
container and to print pdf, server is trying to connect tolocalhost:3000
and gets connection refused errors.@Etoile2 @joaquinvacas For all of you running locally with docker (by just running
docker compose up -d
), here is how to make PDF work:Then
docker compose up -d
and it should work now after refreshing page in browser.The trick is basically to use
network_mode: host
on all services and usePOSTGRES_HOST=localhost
.Better solution without modifying docker compose file
As I understand on local use with docker proper url for pdf printer is
http://client:3000
nothttp://localhost:3000
because we are making request from withingserver
container andlocalhost
meansserver
container itself.So all this could probably be avoided by adding new optional env var e.g.
PDF_PRINTER_URL
that if set, could be used in https://github.com/AmruthPillai/Reactive-Resume/blob/main/server/src/printer/printer.service.ts#L50 like this(I’m not js dev so sorry for garbage code)
This would allow to return correct urls from backend to client app and use this new pdf printer url to make internal calls to client container from within server container.
Still unable to get PDF downloads working. I have also tried using martadinata666’s container because it has client and server together but it gave me the same result. I am using the most basic setup copied from the repository:
Same issue over here, also self-hosted.
Please Use PUBLIC_SERVER_URL=http://localhost:3100/
instead of PUBLIC_SERVER_URL=http://localhost:3100/api
It will work as expected
@AmruthPillai It also works for me, thank you!
I also can’t export a pdf. I am using 3.6.5 in a Synology NAS (latest tags didn’t had the manifest for linux/amd64). I’ve setup the containers behind a reverseproxy and everything is working fine, except the export to pdf.
My setup has this as the URLs: resume-server: - PUBLIC_URL=https://rxresume.mydomain - PUBLIC_SERVER_URL=https://rxresumeserver.mydomain
resume-client: - PUBLIC_URL=https://rxresume.mydomain - PUBLIC_SERVER_URL=https://rxresumeserver.mydomain
When looking at logs, I see an entry that then throws an ERR_NAME_NOT_RESOLVED error: navigating to “
https://rxresume.**mydomainmaja391**/cv-maja-copy/printer?secretKey=mykey
”, waiting until “load”I was expecting that Reactive Resume would add a
/
after the mydomain part of url, and before the parameter (maja391 is the user), but that’s not the case. Is this a known issue or I am messing something on my setup?[EDIT] noticed that this issue was fixed in the 3.7.4, tried again and the latest 3.7.5 is already available and working fine. Thank you so much!
This was the ticket for me. I recreated my resume from scratch by copying and pasting the info from my existing one to a new template and PDF export started working without the need for
dns
orextra_hosts
entries. Duplicating or uploading a saved JSON did not work, I had to recreate from a blank template. I was also able to remove the extraSERVER_URL
from environment variables.I’ve just copied the above docker-compose example (the one with extra_hosts) again and pasted it into a new, blank Linux VM with Docker. The only changes I made was the domain name and extra_hosts IP address. As soon as the containers were up, I registered a new user account, logged in and created a new resume. I’ve also preloaded the resume with the available example data. Hitting the export button generated the PDF promptly.
I even tried accessing the traefik instance from another computer in LAN. Also worked flawlessly and I could generate new resumes and export them as PDF.
I’ve used multiple browsers (MS Edge, Mozilla Firefox and Google Chrome). With each browser it just worked. Not sure how to troubleshoot further, sorry.
Make sure to create a new resume as soon as you’ve changed some configs. It helped me during initial troubleshooting as older resumes were hitting errors again and new ones not.
These are the warnings and errors that pop up in the developer console when I try to export a pdf
Thank you, @funkybunch, it’s works for me.
But I also need to change permissions on folder
/home/debian/reactiveresume/server/dist/assets/
todebian:debian
inside container.Running locally on Docker, using localhost isn’t possible to use the print function.
Any news on this with local usage?
Can anyone provide a working example with a traefik reverse proxy in front, using a local domain name?
Ran into this issue as well, Fix in my case was a firewall change. self managed stack is running behind a Nginx Proxy Manager instance which was configured to only allow certain IP access to service. The instance IP that reactive resume itself was running on was denied access which lead to the print function waiting for a page to load which would never load. suggest you look at url the server is trying to connect to and make sure its accessible