PlatformException(error, Promise was rejected with a value of 'undefined'.,null, null)

@david In the latest upgrade to v5.3.75, I downloaded the full prebuilt invoiceninja.zip. Replaced the files on my server, ran the usual /update?secret=secret and cleared caches. After that the upgrade was completed but PDF generation was broken again until updating snappdf as mentioned above.

v5.5.104 with the same error after migrating via ZIP file.
PDFs are created via PhantomJS wit the API key.

After NN hours, here is the solution:
the PDFs are stored in the public/storage folder. If the Web server is unable to write there, you will get empty PDF files via ‘Download’ or the error mentioned.

sudo chmod -R g+w public/storage
sudo chgrp -R www-data public/storage

Also, storage should be webserver-writable, so

sudo chmod -R g+w storage
sudo chgrp -R www-data storage

Please adjust the www-data to the group your www server is running.

1 Like

Nothing here helped me.

  • Snappdf
  • Arch Linux
  • For test raised memory limit to 1.5 GB
  • Timeouts are already very generous

It works if I delete custom logo, both Flutter and React
Even a logo of 70-80 KB in size makes preview spinning endlessly and blank page.
Right after I delete custom logo PDF preview works fine and fast.

  • With hosted_ninja it is OK with custom logo, no matter size.
  • Invoices - View PDF works fine, fast and custom logo is there.

Do not know it this means something:
http://127.0.0.1:8000/api/v1/live_design

404 | Nothing to see here!

Chrome console error:

InvoiceViewer-b2260d02.js:1 t {message: 'canceled', name: 'CanceledError', code: 'ERR_CANCELED'}
(anonymous) @ InvoiceViewer-b2260d02.js:1
Promise.catch (async)
(anonymous) @ InvoiceViewer-b2260d02.js:1
Qr @ react-dom-1d34f3af.js:16
An @ react-dom-1d34f3af.js:16
uf @ react-dom-1d34f3af.js:16
an @ react-dom-1d34f3af.js:16
lo @ react-dom-1d34f3af.js:16
on @ react-dom-1d34f3af.js:14
(anonymous) @ react-dom-1d34f3af.js:16
axios-95debb6e.js:2     POST http://127.0.0.1:8000/api/v1/live_design 500 (Internal Server Error)
(anonymous) @ axios-95debb6e.js:2
G @ axios-95debb6e.js:2
it @ axios-95debb6e.js:2
_.request @ axios-95debb6e.js:2
(anonymous) @ axios-95debb6e.js:1
N @ index-ee651541.js:57
(anonymous) @ InvoiceViewer-b2260d02.js:1
Qr @ react-dom-1d34f3af.js:16
An @ react-dom-1d34f3af.js:16
(anonymous) @ react-dom-1d34f3af.js:16
C @ scheduler-04ce0582.js:9
L @ scheduler-04ce0582.js:9
InvoiceViewer-b2260d02.js:1 N {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …}code: "ERR_BAD_RESPONSE"config: {transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …}message: "Request failed with status code 500"name: "AxiosError"request: XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}response: {data: ArrayBuffer(33), status: 500, statusText: 'Internal Server Error', headers: {…}, config: {…}, …}[[Prototype]]: Error
(anonymous) @ InvoiceViewer-b2260d02.js:1
Promise.catch (async)
(anonymous) @ InvoiceViewer-b2260d02.js:1
Qr @ react-dom-1d34f3af.js:16
An @ react-dom-1d34f3af.js:16
(anonymous) @ react-dom-1d34f3af.js:16
C @ scheduler-04ce0582.js:9
L @ scheduler-04ce0582.js:9

Deep debug says me nothing special. Laravel log, latest lines cannot see time stamps:

#48 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#49 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#50 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\\Pipeline\\Pipeline->then()
#51 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(134): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#52 /home/stagger-lee/web-development/www/html/invoice-ninja/public/index.php(56): Illuminate\\Foundation\\Http\\Kernel->handle()
#53 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(16): require_once('...')
#54 {main}
"} 

Env file:

NINJA_ENVIRONMENT="selfhost"
APP_NAME="xxxxxxxxx"
APP_ENV=production
APP_KEY=base64:xxxxxxxxxxxx=
APP_DEBUG=false
#EXPANDED_LOGGING=true
#LOG_PDF_HTML=true
APP_URL="http://127.0.0.1:8000"
VITE_API_URL="http://localhost:5173/"
LOCAL_DOWNLOAD=true
REQUIRE_HTTPS="false"
DB_CONNECTION="mysql"
DB_DATABASE="db-ninja-01"
DB_USERNAME="ninja"
DB_PASSWORD="ninja"
PHANTOMJS_PDF_GENERATION=false
#options - snappdf / phantom / hosted_ninja
PDF_GENERATOR=snappdf
SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
DB_HOST="localhost"
DB_PORT="3306"
MAIL_MAILER="log"
MAIL_PORT=""
MAIL_ENCRYPTION="tls"
MAIL_HOST=""
MAIL_USERNAME=""
MAIL_FROM_NAME=""
MAIL_FROM_ADDRESS=""
MAIL_PASSWORD=""

Hi,

Please create a new issue with the full details from the error log, you’ve posted starting from line #48.

Thanks.