V4 to v5 migration problem

Hi, I have installed v5 under a separate subdomain on my Centos7 server which is running cPanel/whm. Everything seems to work ok, when I try to run the migration from v4 I can enter the new installation URL and credentials, all looks well. The message appears; “Migration has started. We’ll update you with status, on your company e-mail.” This seems encouraging…

…But then nothing else happens. The database is never updated for the v5 site. I can see POST and GET entries on the v5 site in storage/logs/laravel.log indicating that the login information was verified and the company info for migration retrieved, but that is all.

It looks that there is a zip file created on the v4 site in storage/migrations which holds a .json file containing migration information.

I can see this message from the v4 site in storage/logs/laravel-error.log:

[2020-12-03 02:52:36] production.ERROR: ErrorException [0] : /home/(user)/invoiceninja/storage/framework/views/f58e5b10961980c5fcf70adb60d1e34ab621ae7f.php [Line 4] => Array to string conversion (View: /home/(user)/invoiceninja/resources/views/migration/includes/errors.blade.php) (View: /home/(user)/invoiceninja/resources/views/migration/includes/errors.blade.php) {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:"(my name)",“method”:“GET”,“user_agent”:“Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36”,“locale”:“en”,“ip”:"(my-ip-address)"(",“count”:2,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“migration/auth”} []

I can’t seem to find any other helpful error messages anywhere, what to do?

Thanks

Hey there!

Thanks for reporting this to us. Are you using the latest v4 & v5?

I’m running 4.5.21 White labeled, and 5.0.31-27. Upgraded my php to 7.4. Both v4 and v5 instances seem to be running ok, it’s just that the migration won’t complete.

All right, can you check logs?

v5: storage/logs/laravel.log
v4: storage/logs/laravel-error.log

In case you’re not technical enough, just pm them to me on forum.

Hi again

No new entries appeared in either of those logs when I attempted the migration.

v5: storage/logs/laravel.log
v4: storage/logs/laravel-error.log

Today I ran the ‘Force Update’ option on v5 from the gui and now it says the version is 5.0.32-27
and the following showed up in the laravel.log:

[2020-12-06 01:19:47] production.INFO: Are there changes to pull?
[2020-12-06 01:19:49] production.INFO: Are there any changes to pull?
[2020-12-06 01:19:49] production.INFO: running post update
[2020-12-06 01:20:26] production.INFO: Are there changes to pull? 1
[2020-12-06 01:20:27] production.INFO: Are there any changes to pull? 1
[2020-12-06 01:20:27] production.INFO: running post update

Then after that I tried the migration from v4 once again.

As before, when running the migration I check ‘self-hosted’, then enter the url of the v5 installation, then the authentication info. The company info appears on the screen, I tick both boxes, and after submission I get the success message: “Migration has started. We’ll update you with status, on your company e-mail.
–Still no results on the v5 installation.

No new entries appear in either log–
v5: storage/logs/laravel.log or
v4: storage/logs/laravel-error.log

However, in poking around I do again find a new zip file, named:
hhh3skpv99c2cgwkxoicn59tnmr9zha3-2020-12-06-invoiceninja.zip
with the current date, created by v4 in its storage/migrations directory.
Uncompressing that zip file reveals the file:
migration.json
which appears to contain the data to be migrated. (?)

Any other suggestions? Your assistance is much appreciated

Thanks again

All right, seems like migration file has been moved successfully from v4 to v5.

You can try this to manually start the migration:

In v5 folder:

php artisan artisan migrations:import

The migration info seems to exist in the v4 files, but not on v5. When I run
php artisan migrations:import
I get the following:

In ImportMigrations.php line 83:
DirectoryIterator::__construct(/home/east/billing/invoiceninja/public/storage/migrations/import): failed to open dir: No such file or directory

Would it be possible to manually move the migration information from the v4 installation to v5? What steps would I need to take?

I tried moving the contents of
v4 storage/migration
to
v5 storage/public/migration/import

Then when I ran
php migratiosn:import

Started processing: hhh3skpv99c2cgwkxoicn59tnmr9zha3-2020-12-06-invoiceninja.zip at 2020-12-06 17:00:58

However, I still get no love. The following now appears in v5
storage/logs/laravel.log

[2020-12-06 17:01:01] production.INFO: the job failed
[2020-12-06 17:01:01] production.INFO: Undefined index: data
[2020-12-06 17:01:02] production.ERROR: Undefined index: data {“userId”:29,“exception”:"[object] (ErrorException(code: 0): Undefined index: data at /home/east/billing/invoiceninja/app/Jobs/Util/Import.php:185)
[stacktrace]
#0 /home/east/billing/invoiceninja/app/Jobs/Util/Import.php(185): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, ‘Undefined index…’, ‘/home/east/bill…’, 185, Array)
#1 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\Util\Import->handle()
#2 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#3 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#4 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#5 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#6 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array)
#7 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\Util\Import))
#8 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\Util\Import))
#9 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#10 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(96): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\Util\Import), false)
#11 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(App\Jobs\Util\Import))
#12 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\Util\Import))
#13 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#14 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(67): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(App\Jobs\Util\Import))
#15 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#16 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\Queue\Jobs\Job->fire()
#17 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\Queue\Worker->process(‘database’, Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#18 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), ‘database’, Object(Illuminate\Queue\WorkerOptions))
#19 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\Queue\Worker->daemon(‘database’, ‘default’, Object(Illuminate\Queue\WorkerOptions))
#20 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand->runWorker(‘database’, ‘default’)
#21 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#22 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#23 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#24 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#25 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#26 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#27 /home/east/billing/invoiceninja/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#28 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#29 /home/east/billing/invoiceninja/vendor/symfony/console/Application.php(971): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /home/east/billing/invoiceninja/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /home/east/billing/invoiceninja/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /home/east/billing/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /home/east/billing/invoiceninja/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 {main}
"}

Thanks again.

This doesn’t look like a correct way of processing migration. Thanks for reporting this to us, I think it’s app bug now.

I’ll update you here, once I got more information.

1 Like

@nemestrinus instead of running php artisan migrations:import you may want to try a regular migration again. Instead this time, in your V5 installation change the line in your .env file QUEUE_CONNECTION to QUEUE_CONNECTION=sync

Once done, just rebuild the cache with php artisan optimize and then attempt the migrartion again from V4.

Thanks, I tried that, but still get the same result. A new zip file containing migration.json is created in the v4 installation under storage/migrations but nothing at all happens on the v5 installation.

Hey @nemestrinus,

Can you join us on Slack so we can have a real-time chat there? I’d like to assist you. Just reach us in #v5-feedback & we’ll reply asap.

OK will proceed there. Thanks so much.

1 Like