Company-A pointing to non configured URL for PDF download

Hi Folks,

yet another strange, weird and wonderful problem with selfhosted docker IN5 (v5.5.93-C109)

Company-A, somehow, in the past several days, decides that in.localhost.test:8003 is the path to download pdfs from (pdf preview works, but PDF view does not), meanwhile Company-B, is working, and PDF download is invoice.localhost.test.
It has been invoice.localhost.test for 12 months (for both). WTF.

I’ve performed for following troubleshooting as there is no error outputed in logs:

  • grep/find ‘in.localhost:8003’ within all files/folder of the docker structure – only present in mysql files
  • env, and docker-compose.yml all checkout fine
  • host files all okay
  • sudo docker-compose exec app php artisan optimize:clear
  • sudo docker-compose exec app php artisan optimize

my next step is to add variable ‘LOG_PDF_HTML=true’ but there is nothing wrong with pdf generation, just some rogue URL.

Is there a configuration file per Company?
Is there some config specifically for PDF downloading?

Thank you.

Hi,

@david any thoughts to debug this?

.env file:

# IN application vars
APP_URL=http://invoice.localhost.test
APP_KEY=base64:REDACTED
APP_DEBUG=false
REQUIRE_HTTPS=false
PHANTOMJS_PDF_GENERATION=false
PDF_GENERATOR=snappdf
TRUSTED_PROXIES='*'
QUEUE_CONNECTION=sync
LOCAL_DOWNLOAD=true
IS_DOCKER=true
# NINJA_ENVIRONMENT=selfhost

# DB connection
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=ninja

# Create initial user
# Default to these values if empty
IN_USER_EMAIL=user@localhost.test
IN_PASSWORD=password123

# Mail options
MAIL_MAILER=null
MAIL_HOST=null
MAIL_PORT=null
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME=null

# MySQL
MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
MYSQL_USER=ninja
MYSQL_PASSWORD=ninja
MYSQL_DATABASE=ninja

#
#

version: '3.7'

services:
  server:
    image: nginx
    restart: always
    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:
      - invoiceninja
    extra_hosts:
      - "invoice.localhost.test:127.0.0.1"

  app:
    image: invoiceninja/invoiceninja:5
    env_file: env
    restart: always
    volumes:
      - ./config/hosts:/etc/hosts:ro
      - ./docker/app/public:/var/www/app/public:rw,delegated
      - ./docker/app/storage:/var/www/app/storage:rw,delegated
    depends_on:
      - db
    networks:
      - invoiceninja
    extra_hosts:
      - "invoice.localhost.test:127.0.0.1"

  db:
    image: mysql:5
#    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
    ports:
      - "3305:3306"
    restart: always
    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:
      - invoiceninja
    extra_hosts:
      - "invoice.localhost.test:127.0.0.1"

  # 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:
  invoiceninja:

Update:
Forgot to mention i do get an error ‘XMLHttpRequest error.’

This occurs after clicking on ‘View PDF’ button

No errors in nginx log
and /docker/app/storage/logs/laravel.log has no errors relating to pdf download, and no mention of in.localhost.test:8003

So, still have no idea how the system is referencing in.localhost.test:8003.

is there a process to re-create the company? and import clients (20x) and invoices (100+), payments, to see if there is some corruption in the existing company file(s)?

Thank you.

Another update:

attempted to export to CSV individual Company-A data sets and received error via web browser

500: Server Error

And error in Invoiceninja server logs:

2023-03-16 15:01:28 2023-03-16T07:01:28Z [ERROR] [Entrypoint]: Error connecting to DB

@dingo

For Company A, if you navigate to Settings > Client Portal is there a value set there for the client portal domain?

You can try to add your URL there and see if that corrects the issue.

Hi @david ,

I don’t use the client portal (never have). I do every thing manually to keep costs down.
The system is purely for me to access, with no connection to WAN. So, I have never configured client portal in the 12 months i’ve used IN.

Granted I have had DNS issues in the past (Windows Host-WSL-Ubuntu-Docker), however, i had corrected those.

Thank you.

@david ,

I checked the client portal settings and invoice.localhost.test is present.

I am now getting 500 error when attempting to login to IN via browser, however, via the windows app it still works (yet the PDF download and export functions still don’t work).

I’ll create a new post with this new problem of not being able to export.

Thank you.

I’m not an expert in docker, but this looks like it may be the problem setting this directory to read only?