Cannot view or download PDF - mostly stock settings with Docker image

I am running Debian Bullseye on an AWS EC2 instance, trying to get the last piece of InvoiceNinja to work – PDF downloads. I’ve deleted my customized docker setup and went back to basics with the stock setup from . Even with this, I am struggling to get PDF downloading to work.

I am wanting to use snappdf to generate the PDFs, which is the default set in the env file.

Using commit:

$ git show --format=%H

Showing only the changes from the default:

$ git diff >> /dev/shm/diff
admin@ip-172-31-16-82:~/build/docker/invoiceninja$ cat /dev/shm/diff 
diff --git a/docker-compose.yml b/docker-compose.yml
index fdd5760..ae1fe4b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,7 +15,8 @@ services:
     # Run webserver nginx on port 80
     # Feel free to modify depending what port is already occupied
-      - "80:80"
+      - "redactedport:80"
+      - "9000:9000"
       #- "443:443"
       - invoiceninja
diff --git a/env b/env
index 931eb0b..9600b19 100644
--- a/env
+++ b/env
@@ -1,6 +1,7 @@
 # IN application vars
-APP_KEY=<insert your generated key in here>
@@ -19,18 +20,18 @@ DB_PASSWORD=ninja
 # Default to these values if empty
 # IN_PASSWORD=changeme!
 # Mail options
-MAIL_FROM_NAME='Self Hosted User'
 # MySQL

I thought that the APP_URL parameter in the env file was not important due to the post here, but it looks like it plays a more important role these days; whenever I click Download on a PDF that I’ve generated inside InvoiceNinja, it opens a new tab in my browser which is pointed at the entry in APP_URL. Even after changing that to point at the domain where I’m hosting InvoiceNinja, it will not download; it just shows a spinning loading icon forever.

Monitoring the output of the nginx container, after a delay I see the following log message:

2022/03/07 05:01:07 [error] 33#33: *43 upstream timed out (110: Connection timed out) while reading response header from upstream, client: redactedip, server: _, request: "POST /api/v1/live_preview?entity=invoice HTTP/1.1", upstream: "fastcgi://redacted_docker_local_ip:9000", host: "", referrer: ""

I have tried various random things I found online for a couple days now, to no avail.


If you’re using a proxy it may help to add TRUSTED_PROXIES=*

@david any thoughts?

Thanks @hillel . I will try that again now that I’ve reset everything to basic defaults. But it did not work earlier in my heavily customized setup.

EDIT: I will eventually be using this through a reverse proxy, but I am connecting directly to the exposed docker port right now, just to try to get things working.

EDIT 2: No dice :frowning:

Not sure, when things deviate from the standard docker compose we have it is tough to provide quality advice.


As I’m showing in my OP, I’m only changing the absolute bare minimum from the default…

Did you come across a solution?
Similar issue - Docker image - issues with file uploads - #21 by sdggq