Migration problem V4 to 5 stops without errors in seconds

I can’t seem to get the migration to work. Here’s the background for my self-hosted install and what I’ve done:
I was running V4 (on Debian 9) for approx 2 years and used the update script (which was the same script I have been using and is approx 6 mos old.) I didn’t ensure PHP7.2 was installed. I was running 7.0. I installed the 7.2 and got my v4 up and running again (4.5.43). All v4 functions seem fine now. I mention this because maybe it’s involved in the issue and I have a PHP problem. (nginx .conf file was changed to php7.2 and “php7.2 artisan optimize” was run.)
I’ve got v5 (v5.3.8-C58) up and running on Ubuntu 20.04. I pointed my existing revproxy server config to the new internal IP address of the v5 instance. No problems there - the v5 site loads fine from the web with https and no certificate warnings are shown. This means my V4 instance is no longer web-accessible - not sure if this is an issue for the upgrade - works fine on LAN though. Using the internal LAN address to the V4 server on http (not https), I clicked the migration button and pointed to the external FQDN https:// address of my V5 server. User name and password/secret don’t seem to be an issue. It says it will email when the migration is finished. Doesn’t seem to do anything after a couple of minutes (maybe just seconds) and I did leave it run for several hours at one point - nothing new in logs and .zip described below doesn’t increase in size.
It just seems to stop. Every time I run it, it creates a new zip in /var/www/html/ninja/storage/app/migrations
and doesn’t seem to grow to a reasonable size. It always stops with only about 599KB of data. Nothing shows up in the laravel-errror.log, nothing in the nginx log. The larvel-info.log stops every time at “production.INFO: get documents [ ] [ ]” (see below).
Nothing shows up in the V5 system logs at all.
V5 and V4 files are all www-data owned.
I’m reasonably sure I have the crontab set up properly on V5 but maybe worth confirming (path is confirmed):
'# m h dom mon dow command

          • php7.4 /usr/share/nginx/invoiceninja/artisan schedule:run >> /dev/null 2>&1

I didn’t setup email or any other functions in V5. Basically vanilla but I created a user/pw that match the V4 setup.

Here’s the log mentioned (laravel-info.log) and where it starts and stops when migration button is triggered:
[2021-09-08 21:54:26] production.INFO: get account [] []
[2021-09-08 21:54:26] production.INFO: get company [] []
[2021-09-08 21:54:26] production.INFO: get co settings [] []
[2021-09-08 21:54:26] production.INFO: get users [] []
[2021-09-08 21:54:26] production.INFO: get tax rates [] []
[2021-09-08 21:54:26] production.INFO: get payment terms [] []
[2021-09-08 21:54:26] production.INFO: get clients [] []
[2021-09-08 21:54:26] production.INFO: get get company gateways [] []
[2021-09-08 21:54:26] production.INFO: get client gateway tokens [] []
[2021-09-08 21:54:26] production.INFO: get vendors [] []
[2021-09-08 21:54:26] production.INFO: get projects [] []
[2021-09-08 21:54:26] production.INFO: get products [] []
[2021-09-08 21:54:26] production.INFO: get credit notes [] []
[2021-09-08 21:54:26] production.INFO: get invoices [] []
[2021-09-08 21:54:29] production.INFO: get recurring invoices [] []
[2021-09-08 21:54:29] production.INFO: get quotes [] []
[2021-09-08 21:54:29] production.INFO: get payments [] []
[2021-09-08 21:54:30] production.INFO: get credits [] []
[2021-09-08 21:54:30] production.INFO: get documents [] []
[2021-09-08 21:54:30] production.INFO: get expense categories [] []
[2021-09-08 21:54:30] production.INFO: get task statuses [] []
[2021-09-08 21:54:30] production.INFO: get expenses [] []
[2021-09-08 21:54:30] production.INFO: get tasks [] []
[2021-09-08 21:54:31] production.INFO: get documents [] []

Any help would be appreciated. I’m not sure what to look at from here.
Thanks and regards,


Is it possible the migration completed? Have you tried logging out and then back into v5, you may need to use the company selector in the top left corner to change companies.

Thanks for getting back to me. I don’t believe that’s the case. I tried log in/out.
I click company name and it says “Company is not activated”. Not sure what that means.
No logo or any data. None of the files in the invoice ninja folder(s) have a date change as well as no log activity pertaining to the data import.

@david any suggestions?

have you tried to switch companies using the company switcher in the top left hand corner?

it looks like you data migrated.

Only one company there and no data in any of the components.

Still testing things but I’m not winning… Grasping at straws here:
Does it matter that I ignore http:// connections from the web (not being forwarded to https://)? ex. the migration script uploads the .zip to the https://world.ip.ex no problem. Would I not see that migration zip file somewhere on the v5 side?
Does it matter that my original V4 server isn’t active with an FQDN when doing the migration?
Does the mysql user and password need to be the same on both versions/servers?

UPDATE - Fixed! - had some sort of database issue or maybe something to do with artisan key:generate key. I created a new key and it worked. On the V5 side I realized this after I put my email creds in the .env file. I started to get emails with a database error saying it couldn’t add a user So note to anyone who reads this – Populate your env file on V5 before attempting the migration. I assumed this wasn’t necessary as the install docs just say:
Populate .env file with new random encryption key
You have an automatically generated .env file with preset encryption key and ready to initialize the setup page.
I assumed it would pull the other info from my existing .env file which doesn’t seem to be the case (unless I have something else I broke on my journey).

Thanks for your help Hillel and David!

1 Like