IN 5.3.39 via docker on Mac - view PDF not working

Hi All,

I’ve installed docker and IN5 on my macbook pro. Everything looks like it’s running smoothly except for the PDF generation (seems like a common issue). I just get the loading icon when I click view PDF.

Chrome’s console shows the following error:
Failed to load resource: net::ERR_NAME_NOT_RESOLVED. in5.test:8000/client/invoice/pVm9f7czXUSzUWGl3dcoVRwW4uXUhtvb/download?t=1641062986350&per_page=999999:1

I’ve added the below to the env file with no success.
IS_DOCKER=TRUE
TRUSTED_PROXIES=*
LOCAL_DOWNLOAD=true

When creating the invoice, the pdf preview shows correctly as does the pdf preview in the invoice design page.

Curiously, does the APP_URL port matter? Do I need to enable it somewhere else?
The default setting was APP_URL=http://in.localhost:8003. I changed it to http://in5.test:8003, without any success.

Any help would be appreciated.

Hi,

@david any thoughts?

@jtm

Are you using the docker-compose file within our dockerfiles repo?

You’ll want to make sure you have the correct APP_URL in the env file in the dockerfile repo, AND in the config/hosts file put your domain name in there also so that the system can resolve your local hostname

Thanks for the reply David.

I followed the install instructions here https://github.com/invoiceninja/dockerfiles so believe I am using the correct file.
Not sure if it makes a difference, but Docker was installed via Install Docker Desktop on Mac | Docker Documentation.

When you say “correct APP_URL in the env file in the dockerfile repo” - how do I know what this should be? I think this is where I’m a bit confused.

This looks like the PDF creation is trying to load a logo or image file, but for some reason in pulling the wrong URL for the install. it may be worth updating cache after you changed the .env file with the APP_URL

Hi n03lm, by reset cache do you mean running “docker-compose exec app php artisan optimize”? If so I’ve done and it didn’t help. I’ve also removed the logo from the invoice but that didn’t help either.

One thing I forgot to mention is that I didn’t do the step to change the owner - “sudo chown -R 1500:1500 docker/app” as doing so result in permissions issue below:

app_1     | cp: can't create directory '/var/www/app/storage/app': Permission denied

yes I think that is the reset command. does your laravel.log shed any light on the PDF creation error it should be in storage/logs inside the docker file system.

IanT (a.k.a. n03lm)

I presume you are using SNAPPDF and not PhantomJS. this should be default in Docker image but worth checking that the .env file explicitly states this.

PDF_GENERATOR=snappdf

“For PhantomJS to work, your Invoice Ninja installation web address must be public; localhost installations or those on private networks won’t be able to use PhantomJS Cloud.” https://github.com/invoiceninja/invoiceninja.github.io/blob/v5-rework/source/docs/self-host-troubleshooting.md

It doesn’t. From what I can see it’s just has a bunch of entries about a new login. I’ve enabled debug mode to see if it would log anything, but that didn’t help.

Sorry, didn’t see your other post. Yes, using snappdf and PHANTOMJS_PDF_GENERATION=false

I presume you system’s hosts file has an entry

in5.test 127.0.0.1

or similar or you wouldn’t be able to access the interface at all so I’m not clear why the PDF creator is not getting there are they post looking for the same port that you have it set up on (what did the chrome console say again?)

That’s correct. It’s odd that pdf works in preview when you create the invoice but not when you view it.

Console entry below (note I changed the app url to 8000 - didn’t make a difference though)

in5.test:8000/client/invoice/6LeOwZsSAwlaKjnZRXKDeRbmTdx4VdIs/download?t=1641127611735&per_page=999999:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

and nothing similar in the end of the larval.log?

Not that I can see. The log’s a bit hard to read, but if I read it as a HTML file, it looks like it’s just emails to me with new login notifications.

Interestingly it mentions an IP of 172.x.x.x - is this dockers IP? My internal IP is 192.x.x.x.

Am I reading the right log file?

installlocation/dockerfiles/docker/app/storage/logs/laravel.log