dockerfiles icon indicating copy to clipboard operation
dockerfiles copied to clipboard

Unable to view / print / download PDF invoices in docker

Open markdesouza opened this issue 2 years ago • 11 comments

Setup

  • Version: v5.7.10-C123
  • Environment: Docker-Compose (from https://github.com/invoiceninja/dockerfiles)

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=<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


markdesouza avatar Sep 07 '23 08:09 markdesouza

Yep me too, exact same problem

iamahoooman avatar Sep 10 '23 18:09 iamahoooman

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

markdesouza avatar Sep 10 '23 22:09 markdesouza

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

turbo124 avatar Sep 10 '23 23:09 turbo124

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

Cheers, Mark

markdesouza avatar Sep 10 '23 23:09 markdesouza

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

turbo124 avatar Sep 10 '23 23:09 turbo124

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?

markdesouza avatar Sep 10 '23 23:09 markdesouza

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.

turbo124 avatar Sep 10 '23 23:09 turbo124

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

markdesouza avatar Sep 10 '23 23:09 markdesouza

@markdesouza

In Settings > Client Portal

What is the URL defined for your client portal?

turbo124 avatar Sep 11 '23 00:09 turbo124

http://localhost:8003

markdesouza avatar Sep 11 '23 00:09 markdesouza

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

markdesouza avatar Sep 11 '23 00:09 markdesouza