invoiceninja / dockerfiles

Docker files for Invoice Ninja
https://hub.docker.com/r/invoiceninja/invoiceninja
GNU General Public License v2.0
418 stars 268 forks source link

Unable to view / print / download PDF invoices in docker #534

Closed markdesouza closed 5 months ago

markdesouza commented 1 year ago

Setup

Describe the bug

Unable to view / print / download PDF invoices (the URL is wrong)

eg http://localhost:8003/client/invoice/K1r9w3ljZCvS1Wuy6dGwVGn5n8huLTg2/download?t=1694075882638 should be http://in.localhost/client/invoice/K1r9w3ljZCvS1Wuy6dGwVGn5n8huLTg2/download?t=1694075882638

Steps To Reproduce

Create an invoice attempt to download the pdf

Expected Behavior

to be able to download the pdf, without manually correcting the URL

Additional context

Here is the start of my env file.... APP_URL=http://in.localhost APP_KEY= APP_DEBUG=false REQUIRE_HTTPS=false PHANTOMJS_PDF_GENERATION=false PDF_GENERATOR=snappdf TRUSTED_PROXIES='*' LOCAL_DOWNLOAD=false IS_DOCKER=true QUEUE_CONNECTION=database

iamahoooman commented 1 year ago

Yep me too, exact same problem

markdesouza commented 1 year ago

Yep me too, exact same problem

Glad I'm no the only one. Might have to do with the recent pdf generation refactoring they did recently

turbo124 commented 1 year ago

I've just spun up the latest dockerfile 5.7.11 and am not seeing this issue.

could you try one thing, in the env file add

IS_DOCKER=true
markdesouza commented 1 year ago

Hi David, As per the inital report, "IS_DOCKER=true" is already set...

Cheers, Mark

turbo124 commented 1 year ago

are you using some other reverse proxy here? or is this a plain vanilla docker-compose file from our repo?

markdesouza commented 1 year ago

I'm simply using the docker-compose file from our repo and updated the env file.. diff of the env file below:

-APP_URL=http://in.localhost:8003
-APP_KEY=<insert your generated key in here>
-APP_DEBUG=true
+APP_URL=http://in.localhost
+APP_KEY=<REDACTED>
+APP_DEBUG=false
 REQUIRE_HTTPS=false
 PHANTOMJS_PDF_GENERATION=false
 PDF_GENERATOR=snappdf
 TRUSTED_PROXIES='*'
-
-
+LOCAL_DOWNLOAD=false
+IS_DOCKER=true
 QUEUE_CONNECTION=database

One thing I forgot to mention is that I'm running docker on a MacBook. I think docker on macos it creates a VM, so that might explain why the port is not exposed on localhost?

turbo124 commented 1 year ago

can you set local_download to true also please.

as long as you have the domain in.localhost set in your /etc/hosts file it should resolve as expected.

markdesouza commented 1 year ago

Nope still sent to the wrong url "http://localhost:8003/client/invoice/"

It appears like the download invoice button is ignoring the APP_URL environment var

turbo124 commented 1 year ago

@markdesouza

In Settings > Client Portal

What is the URL defined for your client portal?

markdesouza commented 1 year ago

http://localhost:8003

markdesouza commented 1 year ago

ok so: 1) setting that to http://in.localhost 2) saving the settings 3) restarting the container 4) refreshing the browser

fixed the issue

note: didn't work after simply saving the settings