Dynamically generated PDF files do not open on my deployed digital ocean application.


I was able to successfully launch my MVP application to digital ocean by creating a droplet and cloning my github repository. However, a core feature of my application is generating a dynamic contract which then opens as a PDF in a new tab. While it works perfectly fine on localhost, this feature no longer works on my deployed version. The new page renders empty with “you need to enable javascript to run this app” in the network response/preview.

The contract itself is being successfully generated and stored in the file it should. The absolute file path for the location where all the PDFs are being stored is /root/unbound/server/contracts/2022-02-09test_doc.pdf

The front end code attempts to open the PDF file with the following

(adding either root or server to the file path does not solve the problem)

I am not sure if this is related but my attempts to open the PDF file directly from my digital ocean droplet through Ubuntu generates the following errors:

xdg-open 2022-02-09test_doc.pdf

Error: no “view” rule for type “application/pdf” passed its test case (for more information, add “–debug=1” on the command line) /usr/bin/xdg-open: 869: www-browser: not found /usr/bin/xdg-open: 869: links2: not found /usr/bin/xdg-open: 869: elinks: not found /usr/bin/xdg-open: 869: links: not found /usr/bin/xdg-open: 869: lynx: not found /usr/bin/xdg-open: 869: w3m: not found xdg-open: no method available for opening ‘2022-02-09test_doc.pdf’

Attempts with evince also did not work with the following error: Unable to init server: Could not connect: Connection refused Cannot parse arguments: Cannot open display:

Does anyone have any ideas on what might be going on? Your help is greatly appreciated.

Best, Enrique

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


Seems like you might have to install lynx first.

You can do that by running the following command:

sudo apt-get install lynx

Let me know how it goes!