FormatException: SyntaxError: Unexpected token < in JSON at position 0

I’m running v5.5.8-C90 on Debian 11 without any issues. everything is working as it should, but since 5.4 (before PHP8.1) I always get “FormatException: SyntaxError: Unexpected token < in JSON at position 0” during the update process and of course no update is performed.

The only way for me to update is to download the latest source, rsync the files to /var/www/html, run composer install and set the owner to www-data recursively and then continue.

I’m running PHP 8.1.8 with the latest version of Composer 2.3.10

Any idea what the issue might be?

Hi,

It may help to increase the PHP memory limit on the server.

Unforunately up’ing the Memory Limit to 1024M instead of 128 and increasing the post max sizes by a factor of 10 makes no difference.

@david any thoughts?

You might also have to increase fastcgi timeouts:

fastcgi_read_timeout 300;
fastcgi_connect_timeout 300s;
fastcgi_read_timeout 300s;
fastcgi_keep_conn on;

If you have a reverse proxy might have to increase timeouts there as well.
We had the same issue, although the upgrade was succeeding in the background after a few more minutes. Increasing those and reverse proxy solved it for us.

1 Like

Check in storage/logs/invoiceninja.log for any info.