Error 500 migrating from v4 to v5

I have successfully upgraded my v4 server to v4.5.50 nd migrated the data into it.
I have v5.5.49 running on a separate VM, and have done the basic configuration. I am able to log into the portal with identical credentials as the v4 server

when I try to migrate, it asks for link to new application - i assume this means the web address of the portal? https://server_IP:port?
that’s what I’m entering there
for credentials I am supplying the owner portal login
there is no API_SECRET parameter in the v5 .env file, so I am omitting that

next, I get a 500 server error on the old server

how to troubleshoot?


My first toughts on this are:

  • Make sure the new v5 install has a valid certificate when using SSL (or try without ssl but I would not recommend in any way because it may leak your data to the internet).
  • Why are you using :port ? Just would do (the address where you access the v5 install)
  • You can ignore the API secret if there is nothing there (leave blank)

Kind regards

//EDIT: Please make sure the login credentials (specially email address) are exactly the same on both v4 and v5 as it will return error 500 when they are not; to what I experienced.

1 Like

i use port 4443 for SSL. and certificate is valid but since neither machine are routed outside the network yet, I am accessing them by internal IP address. I could do some hosts file entries and see if that helps.

different problem now - I am trying to first make sure my v5 instance is properly configured
I am getting a PHP memory too low in health check…
when I check PHP memory limit in command line, I get 1024M
but invoiceninja still reports 128M - where else might this be set besides php.ini?

another question…
does cron have to be configured on the v4 server as well as the v5? since they are different VMs, figured I’d ask.

You can use a phpinfo page to confirm the server’s memory setting, I suggest asking your webhost for advise on how to increase it.

Yes, both the v4 and v5 crons need to be enabled.

I am the webhost. Both servers are configured from scratch, on prem.

phpinfo lists /etc/php/8.2/fpm/php.ini as the loaded config file. I have set the memory limit there to 1024M. info page still reports 128M. I did restart nginx. Might revert to a prior snapshot of the VM and start over from a point.

How do I confirm the cron(s) are working on each vm?

Thanks -

@david do you have any thoughts?

In v5 you’ll see an error in the app if the crons aren’t enabled.

Yes - and the crons are different from setting up the queue, right? I still see an item about the queue in health check, but the cron warning is gone - which should mean it’s enabled and working?

I will snapshot both VMs, enable crons on the v4 machine and attempt a migration. Worst case, I can always revert back to the VM states before.

Correct. if the cron warning is gone it means the cron is running.

Just to note, PHP8.2 has not been tested with v5.5.x

OK… so what version of PHP should I be using exactly? I believe hillel told me 8.1 was required.
Here’s the post:

But 8.2 is untested? So that means for the latest version - v5.5.49 - I should be using precisely PHP 8.1, and 8.1 only?
it would be great to have a list of all the PHP extensions it requires also, preferably in an apt install command format : )
Since I’ll be rebuilding the VM anyway, it would be fantastic to have the full system requirements actually… How much RAM? How many CPUs? Any other details I should know?
Thanks : )

v4 requires PHP 7.4
v5 requires PHP 8.1

The required PHP extensions are listed here:

OK… I rebuilt the VM from a prior point. When I did the initial ninja configuration, it took me to error 500 after the initial setup.
re-ran permissions on the web folders and was able to load the login screen
but once I’m in there, it prompts me to configure the company name and details (Welcome to InvoiceNinja prompt).
However, it is not offering valid choices for language and currency… English and USD is not available.
I could choose Arabic, Bulgarian, Estonian, Hebre, Latvian, Persian, Russian, Serbian and Slovak…
The currency list is similarly bizarre…

It may help to clear the cache by loading /update?secret=

how exactly do I do this?
after the ninja URL in a browser?

another issue I am having - still - is that php memory_limit is not budging.
the reported ini file is /etc/php/8.1/cli/php.ini
in that file, the default defined limit was -1, which should mean no memory limit.
when I change it to 1024M, it does not change in the output of phpinfo()

so it looks like until I can figure out where this memory limit is set, I won’t get very far anyway…
this is an ubuntu server 20.04 LTS, set up from scratch with php8.1…

nm on php - the correct ini file was in /etc/php/8.1/fpm/php.ini because I am using nginx
for anyone else experiencing the same problem,
php -i
reports a different path than phpinfo()

finally getting back to this…
so - it appears the connection between the two servers (v4 and v5) is established, so a migration could happen but snags somewhere.

here’s the laravel log (part of it anyway) from the v5 instance, that appears to pertain to migration)

[2023-01-02 21:53:34] production.INFO: Importing account
[2023-01-02 21:53:34] production.INFO: Importing company
[2023-01-02 21:53:35] production.INFO: Importing users
[2023-01-02 21:53:36] production.INFO: Importing payment_terms
[2023-01-02 21:53:36] production.INFO: Importing tax_rates
[2023-01-02 21:53:36] production.INFO: Importing clients
[2023-01-02 21:54:23] production.INFO: Importing company_gateways
[2023-01-02 21:54:23] production.INFO: Importing client_gateway_tokens
[2023-01-02 21:54:23] production.INFO: Importing vendors
[2023-01-02 21:54:33] production.INFO: Importing projects
[2023-01-02 21:54:37] production.INFO: Importing products
[2023-01-02 21:54:37] production.INFO: Importing credits
[2023-01-02 21:54:37] production.INFO: An email must have a "From" or a "Sender" header.
[2023-01-02 21:54:37] production.ERROR: An email must have a "From" or a "Sender" header. {"userId":1,"exception":"[object] (Symfony\\Component\\Mime\\Exception\\LogicException(code: 0): An email must ha>

@david do you have any ideas?

Can you ensure you have your mail server configured on v5, (it is complaining about no FROM_NAME / FROM_EMAIL) or just set the .env var



php artisan optimize

It looks like the failure is from the system unable to send the migration failed email to you.