Open ret1 opened 4 days ago
I cannot recreate this on my docker instance, I would suggest exec sh into the container and see if the file actually exists in that location.
hello @turbo124 !
The filepath referenced in the log appears to be relative (var/www/app/public/storage/xKdK81rHaAnqLuYBQ9cZDW82DJOWJv4x/documents/4a0UELp58h2InMIIQ0VhTZPsqVriLWpG.pdf). However, this file does indeed exist in the Nginx container at the following absolute path:
/var/www/app/public/storage/xKdK81rHaAnqLuYBQ9cZDW82DJOWJv4x/documents/4a0UELp58h2InMIIQ0VhTZPsqVriLWpG.pdf
@ret1
Are you using a custom dockerfile, or the standard one as included in invoiceninja/dockerfiles?
Hello @turbo124 ! I've made some adaptions regarding the network settings and the restart behaviour, but the volume config is exactly the same. here is my docker-compose file:
server:
image: nginx
restart: unless-stopped
env_file: env
volumes:
# Vhost configuration
#- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
- ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
- ./docker/app/public:/var/www/app/public:ro
depends_on:
- app
# Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied
# ports:
# - "80:80"
# #- "443:443"
networks:
haproxy-network-invoiceninja:
ipv4_address: 10.0.10.101
ipv6_address: fd4d:6169:6c63:10::101
# extra_hosts:
# - "in5.localhost:192.168.0.124 " #host and ip
app:
image: invoiceninja/invoiceninja:5
env_file: env
restart: unless-stopped
volumes:
- ./config/hosts:/etc/hosts:ro
- ./docker/app/public:/var/www/app/public:rw,delegated
- ./docker/app/storage:/var/www/app/storage:rw,delegated
- ./config/php/php.ini:/usr/local/etc/php/php.ini
- ./config/php/php-cli.ini:/usr/local/etc/php/php-cli.ini
depends_on:
- db
networks:
haproxy-network-invoiceninja:
ipv4_address: 10.0.10.102
ipv6_address: fd4d:6169:6c63:10::102
# extra_hosts:
# - "in5.localhost:192.168.0.124 " #host and ip
db:
image: mysql:8
# When running on ARM64 use MariaDB instead of MySQL
# image: mariadb:10.4
# For auto DB backups comment out image and use the build block below
# build:
# context: ./config/mysql
restart: unless-stopped
env_file: env
volumes:
- ./docker/mysql/data:/var/lib/mysql:rw,delegated
# remove comments for next 4 lines if you want auto sql backups
#- ./docker/mysql/bak:/backups:rw
#- ./config/mysql/backup-script:/etc/cron.daily/daily:ro
#- ./config/mysql/backup-script:/etc/cron.weekly/weekly:ro
#- ./config/mysql/backup-script:/etc/cron.monthly/monthly:ro
networks:
haproxy-network-invoiceninja:
ipv4_address: 10.0.10.103
ipv6_address: fd4d:6169:6c63:10::103
# extra_hosts:
# - "in5.localhost:192.168.0.124 " #host and ip
# THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5.
# cron:
# image: invoiceninja/invoiceninja:alpine-4
# volumes:
# - ./docker/app/public:/var/www/app/public:rw,delegated
# - ./docker/app/storage:/var/www/app/storage:rw,delegated
# - ./docker/app/public/logo:/var/www/app/public/logo:rw,delegated
# entrypoint: |
# /bin/sh -c 'sh -s <<EOF
# trap "break;exit" SIGHUP SIGINT SIGTERM
# sleep 300s
# while /bin/true; do
# ./artisan ninja:send-invoices
# ./artisan ninja:send-reminders
# sleep 1d
# done
# EOF'
# networks:
# - invoiceninja
#
networks:
haproxy-network-invoiceninja:
external: true
make sure you have IS_DOCKER=true in your .env file
The IS_DOCKER=true setting was not enabled, but this doesn’t appear to be the cause of the issue (including for future conversions of quotes to invoices). After further investigation, I identified additional details.
When I convert a quote to an invoice that already has an attached document, the URL field for the invoice in the database is stored as follows:
/var/www/app/public/storage/xKdK81rHaAnqLuYBQ9cZDW82DJOWJv4x/documents/PHQZha0xYjJvIQ09xWM3Cf3MXcTjsBVL.pdf
However, if I attach a document to the invoice after converting the quote, the URL field appears as:
xKdK81rHaAnqLuYBQ9cZDW82DJOWJv4x/documents/lqLdh7QciKhEgfKGMQYbM6Zk5ndVCeBBr6JMRMIf.pdf
Upon reviewing all records in the documents table, it seems that only entries with documentable_type = invoice contain the fully qualified path (starting with /var/www...). Furthermore, only these entries cannot be accessed via the Invoice Ninja web interface.
After manually removing the /var/www/app/public/storage/ prefix from all affected records, I was able to successfully open all attached documents.
This leaves the question of why and where the incorrect path is being generated and written to the database.
Hi everyone!
Version v5.10.44 Environment Docker
When I attempt to download or view a document attached to an invoice, I receive an error message (see screenshot):
The following error appears in the logs:
However, the file mentioned in the log does exist and is readable:
My assumption: I generated the affected invoice from an offer. During this process, the document attached to the offer is “copied” to the invoice. When I try to open the same document under the original offer, it works without issue. Could it be that this problem only occurs when an invoice is created from an offer that already has attached documents?