Error 404 for old invoice PDFs generated before migration

Hi team,

I am encountering an error 404 issue for any invoice PDF that was generated before I migrated to v5 from v4 (image attached below).

I also found this in my Laravel log file:

[2021-11-13 11:41:42] production.ERROR: File not found at path: G1XWAGaurjgT8S5qyCHlvnDYT4QVsYEQ/trQuik4oB2Bm12dZjoDuUzhYmUGM3AnHGLHhkC3p/cjacsuzw00yc9efyunyurhlhvfv9honx/invoices/0246.pdf {"exception":"[object] (Illuminate\\Contracts\\Filesystem\\FileNotFoundException(code: 0): File not found at path: G1XWAGaurjgT8S5qyCHlvnDYT4QVsYEQ/trQuik4oB2Bm12dZjoDuUzhYmUGM3AnHGLHhkC3p/cjacsuzw00yc9efyunyurhlhvfv9honx/invoices/0246.pdf at /mnt/vdb/home1/user/public_html/billing/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php:159)
[stacktrace]
#0 /mnt/vdb/home1/user/public_html/billing/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php(398): Illuminate\\Filesystem\\FilesystemAdapter->get('G1XWAGaurjgT8S5...')
#1 /mnt/vdb/home1/user/public_html/billing/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\\Filesystem\\FilesystemManager->__call('get', Array)
#2 /mnt/vdb/home1/user/public_html/billing/app/Http/Controllers/InvoiceController.php(817): Illuminate\\Support\\Facades\\Facade::__callStatic('get', Array)
#3 /mnt/vdb/home1/user/public_html/billing/vendor/symfony/http-foundation/StreamedResponse.php(109): App\\Http\\Controllers\\InvoiceController->App\\Http\\Controllers\\{closure}()
#4 /mnt/vdb/home1/user/public_html/billing/vendor/symfony/http-foundation/Response.php(394): Symfony\\Component\\HttpFoundation\\StreamedResponse->sendContent()
#5 /mnt/vdb/home1/user/public_html/billing/public/index.php(61): Symfony\\Component\\HttpFoundation\\Response->send()
#6 {main}

[previous exception] [object] (League\\Flysystem\\FileNotFoundException(code: 0): File not found at path: G1XWAGaurjgT8S5qyCHlvnDYT4QVsYEQ/s2B1z3tT4Ou9vsjzKQcZqRsb98gEMbuj4NZCCwrY/ddybza7tp1pjwpyg8mlszp4fqvnaaq0h/invoices/0001.pdf at /mnt/vdb/home1/user/public_html/billing/vendor/league/flysystem/src/Filesystem.php:390)
[stacktrace]
#0 /mnt/vdb/home1/user/public_html/billing/vendor/league/flysystem/src/Filesystem.php(180): League\\Flysystem\\Filesystem->assertPresent('G1XWAGaurjgT8S5...')
#1 /mnt/vdb/home1/user/public_html/billing/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(157): League\\Flysystem\\Filesystem->read('G1XWAGaurjgT8S5...')
#2 /mnt/vdb/home1/user/public_html/billing/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php(398): Illuminate\\Filesystem\\FilesystemAdapter->get('G1XWAGaurjgT8S5...')
#3 /mnt/vdb/home1/user/public_html/billing/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\\Filesystem\\FilesystemManager->__call('get', Array)
#4 /mnt/vdb/home1/user/public_html/billing/app/Http/Controllers/InvoiceController.php(817): Illuminate\\Support\\Facades\\Facade::__callStatic('get', Array)
#5 /mnt/vdb/home1/user/public_html/billing/vendor/symfony/http-foundation/StreamedResponse.php(109): App\\Http\\Controllers\\InvoiceController->App\\Http\\Controllers\\{closure}()
#6 /mnt/vdb/home1/user/public_html/billing/vendor/symfony/http-foundation/Response.php(394): Symfony\\Component\\HttpFoundation\\StreamedResponse->sendContent()
#7 /mnt/vdb/home1/user/public_html/billing/public/index.php(61): Symfony\\Component\\HttpFoundation\\Response->send()
#8 {main}
"} ```

It’s also affecting any PDFs that get re-generated (edited invoices).

Hi,

@david any thoughts?

It sounds like your PDF creation isn’t working at all. Can you check file permissions.

Note all services should be running as the webuser and the webuser should own all directories under storage/ and public/storage

Yup they’re all good, it’s a cPanel Softaculous installation so permissions should be automatically configured?
It was working before… but now it’s not.

@NZNinja

Are you Using PhantomJS? Perhaps your API key has run out of credits to generate PDFs?

Note, if you have a white label license, you can change the PDF generator to hosted_ninja which gives you unlimited PDFs

I was using Phantomjs but found it slow (but worked), so I switched to snappdf which worked for a bit and now does this.

Is the hosted_ninja API as fast as the snappdf generation method?

I do have a white label license :slight_smile:

Edit: Switched over to hosted_ninja and it’s great! Really fast too.