Migration error Invoice ninja 4.5.34 > v5

Invoice ninja 4.5.34 > v5

I upgraded my v4 to the latest version to before the start the migration to v5 and followed:

Start migration
Select Self-hosted
provided new url with v5 installation
provided email address admin + password plus key of env. I even copy pasted the key so even they are identical.
Selected the company

then i get the error WHOOPS, …

[2021-03-01 13:05:04] production.ERROR: ErrorException [0] : ABSPATH/app/Http/Controllers/Migration/StepsController.php [Line 262] => ZipArchive::close(): Failure to create temporary file: No such file or directory {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“MYUSERNAME”,“method”:“POST”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36”,“locale”:“en”,“ip”:“MYIP”,“count”:6,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“migration/companies”} []

Found another person in the forum that had the exact same issue, which had a solution to manually create and chown the migrations folder, but it did not help for me.

Im using a VM with Ubuntu 20.04 and PHP 7.3 as source (v4) and PHP 7.4 as target (v5). Can someone help me further?

I also have to say now in addition to above i migrated V4 to V4 another server with a clean install and replaced the DB from the older server. Still have the same error as above.

I use ISPConfig as underlying management tool for my sites.

@david, @ben any ideas?


The only things that come to mind are a missing php-zip extension OR folder permissions are not set for the web user to write/create folders/files which is preventing the file from being written.

I can guarantee php-zip and php7.3-zip is installed.
php-zip is already the newest version (2:8.0+81+ubuntu20.04.1+deb.sury.org+1).

I chmodded all folders to 775.

same issue.

does the directory storage/migrations exist?

Hi David,

No it did not. I created the dir and chowned it to the webuser. Now it says Migration has started.

This is strange because as stated in the creation of the thread i created the folder manually and still got the issue. Maybe it was something else what got solved when i migrated the server van v4 to v4.

As i got an email a few days back that v5 is stable i reinstalled the new environment. On the new server (v4) i have not enabled cron yet. Will this be the reason why the migration doesn’t start?

So, if the .zip file has been created that would be the end of the functionality on V4. The next step is to observe v5 and see how the migration has performed. You’ll want to make sure the cron and queue are working there.

Hey there!
I have exactly the same issue… I also manually created the directory storage/migrations, but it didn’t help.

HI lucaw, are there any errors in the logs? I am assuming that the entire invoice ninja directory is owned by the web user?

Hi David
Thanks for your message.
Yes, the directory is owned by the web user.

That’s the only error message:

[2021-03-09 15:14:58] production.ERROR: ErrorException [0] : /home/sites/path/public_html/invoiceninja/app/Http/Controllers/Migration/StepsController.php [Line 262] => ZipArchive::close(): Failure to create temporary file: No such file or directory {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“username”,“method”:“POST”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.8.334.710 Safari/537.36”,“locale”:“en”,“ip”:“xxxx”,“count”:2,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“migration/companies”} []

There is something missing here, this really looks like a permissions issue where the app cannot write the file to the directory.

Actually, there is a 13.2kb file in /public_html/invoiceninja/storage/migrations:

perfect, that means we have success… now check V5 side to see if there are any errors in the logs? the most common issue on the V5 side is that the queue is not running.

hey david, thanks a lot! It finally worked - looks like it just took more than 24h to import the file to V5. So the solution is to manually create the folder.
thanks for your great work!