Migrating from v4 to v5 - Different servers

I’m curious if anyone is attempting to move from v4 to v5 with different servers. I can’t seem to find much documentation about it, but when I go to Settings → Account Management, I get to the part where it asks me to authenticate - but on clicking ‘Continue’ nothing happens.

I’m sure there’s something I’m missing… but I can’t figure it out. I’m attempting to move from:

my.ciits.co.uk

to

v5.ciits.co.uk

  • Once it’s complete, I’ll be attempting to update v5 to my - but using the new server.

Any help would be greatly appreciated.

Paul

Hey there!

Thanks for reporting this to us. Can you check if there’s anything in v5 logs?

You can find them in storage/logs/laravel.log/ file.

Thanks!

1 Like

Just looked on v5 server and there’s nothing in the error log. It’s blank.
Looking at network inspector on the v4, it’s making a POST to /migration/auth where it get a 302. Then there’s a 200 GET to the same URL. Not sure if this helps at all.

Can I know the version of Invoice Ninja v4 that is in use? Also, a version of v5 would be nice.

Of course,

v4.5.19
v5.0.31-26

There are updates to 4.22 or so that are improvements to migration, important updates to prepare.

Both servers need resolvable domains. This can be worked around with edit to hosts file if necessary.

2 Likes

Thank you for that. I’ve upgraded it to the latest v4 version.
I attempted the migration but am now showing this error:

Error: Make sure you did proper setup with V5 of Invoice Ninja, before starting migration

So, I’m not sure where to go next. v5 is installed fine and I can login etc without issue. Is there something I’ve obviously missed?

Thanks for your help.

Hey @ItsJustPW

I am able to replicate your issue! You could wait us to fix this in upcoming v4 (within a day or two).

Issue is v5 .env file having API_SECRET set to something. If you make it empty:

API_SECRET=

you should be able to pass this screen!

2 Likes

Issue was resolved thanks to the Invoice Ninja Slack channel and speaking to Benjamin. Really, really amazing support from Invoice Ninja.

Thank you!

1 Like

And yes use 4.23 or latest version

I’m having the same problem. Can you tell us your solution? Thanks friend.

Hey there,

Issue is that v5 is requiring an API_SECRET to be set. Just open .env file of Invoice Ninja v5 and remove whole line.

After that just run:

php artisan optimize

Sorry for the delay… exactly what Ben is saying - it was because of the API_SECRET which was causing the issue.

1 Like

How do I edit it in a docker installation?

I remember reading that I could map the .env file to a persistent folder.

Here’s how you can do it in Docker.

Navigate to invoiceninja5 directory.

Run this to enter docker container:

docker-compose exec app sh
cd /var/www/app
vi .env

Now find a line with API_SECRET and delete it. Save the file & run this inside the Docker container:

php artisan optimize

In case you’re not familiar with vi:

To open file: vi .env
To write: Press “I”
To save: Press ESC, then “:” and then “wq”

That should save & quit.

Thank’u so much. I’ll try and comment.

Hi guys, I have both latest versions v4 and v5. I have tried again to migrate to v5, changing what was commented above. I see the migration files in both locations of the two instances, but nothing else happens. The companies that I have in v4 are created into v5, but empty … without any content. I don’t know what I can be doing wrong. The migration assistant does not give any errors. :worried:

I see a new thing at ‘Health Check’ --> Config Cached with a orange triangle.

It’s working :grinning:

docker-compose exec app php artisan schedule:run >> /dev/null 2>&1

Now i can see the log importing my data. :clap: :clap: :clap:

2 Likes

Hey there! Great to hear that! Please update us on how it went :+1:

[2020-12-17 17:20:41] production.INFO: migrations/2qwjtlzdhwgylsekda9jpeauap7mogkh-2020-12-17-invoiceninja.zip  
[2020-12-17 17:25:08] production.INFO: Importing company  
[2020-12-17 17:25:09] production.INFO: Importing users  
[2020-12-17 17:25:09] production.INFO: Importing payment_terms  
[2020-12-17 17:25:09] production.INFO: Importing tax_rates  
[2020-12-17 17:25:09] production.INFO: Importing clients  
[2020-12-17 17:26:27] production.INFO: Importing vendors  
[2020-12-17 17:26:27] production.INFO: Importing projects  
[2020-12-17 17:26:28] production.INFO: Importing products  
[2020-12-17 17:26:29] production.INFO: Importing credits  
[2020-12-17 17:26:32] production.INFO: Importing invoices  
[2020-12-17 17:45:50] production.INFO: Importing recurring_invoices  
[2020-12-17 17:46:07] production.INFO: Importing quotes  
[2020-12-17 17:54:57] production.INFO: Importing payments  
[2020-12-17 18:32:18] production.INFO: Importing company_gateways  
[2020-12-17 18:32:18] production.INFO: Importing client_gateway_tokens  
[2020-12-17 18:32:18] production.INFO: Importing expense_categories  
[2020-12-17 18:32:18] production.INFO: Importing task_statuses  
[2020-12-17 18:32:18] production.INFO: in task statuses  
[2020-12-17 18:32:19] production.INFO: finished task statuses  
[2020-12-17 18:32:19] production.INFO: Importing expenses  
[2020-12-17 18:32:19] production.INFO: Importing tasks  
[2020-12-17 18:32:19] production.INFO: Missing resource key: task_statuses_4  
[2020-12-17 18:32:20] production.ERROR: Missing resource key: task_statuses_4 {"userId":1,"exception":"[object] (Exception(code: 0): Missing resource key: task_statuses_4 at /var/www/app/app/Jobs/Util/Import.php:1299)
[stacktrace]
#0 /var/www/app/app/Jobs/Util/Import.php(1160): App\\Jobs\\Util\\Import->transformId('task_statuses', '4')
#1 /var/www/app/app/Jobs/Util/Import.php(198): App\\Jobs\\Util\\Import->processTasks(Array)
#2 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\Import->handle()
#3 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#4 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#5 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#6 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#7 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call(Array)
#8 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(App\\Jobs\\Util\\Import))
#9 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\Util\\Import))
#10 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#11 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(67): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(App\\Jobs\\Util\\Import))
#12 /var/www/app/app/Jobs/Util/StartMigration.php(111): App\\Jobs\\Util\\Import::dispatchNow('/var/www/app/pu...', Object(App\\Models\\Company), Object(App\\Models\\User))
#13 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\StartMigration->handle()
#14 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#15 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#16 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#17 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#18 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call(Array)
#19 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#20 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#21 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#22 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(96): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(App\\Jobs\\Util\\StartMigration), false)
#23 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#24 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#25 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(98): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#26 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(67): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(App\\Jobs\\Util\\StartMigration))
#27 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Array)
#28 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\\Queue\\Jobs\\Job->fire()
#29 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\\Queue\\Worker->process('database', Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(Illuminate\\Queue\\WorkerOptions))
#30 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), 'database', Object(Illuminate\\Queue\\WorkerOptions))
#31 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\\Queue\\Worker->daemon('database', 'default', Object(Illuminate\\Queue\\WorkerOptions))
#32 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\\Queue\\Console\\WorkCommand->runWorker('database', 'default')
#33 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#34 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#35 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#36 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#37 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#38 /var/www/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call(Array)
#39 /var/www/app/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#40 /var/www/app/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))
#41 /var/www/app/vendor/symfony/console/Application.php(971): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#42 /var/www/app/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))
#43 /var/www/app/vendor/symfony/console/Application.php(166): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#44 /var/www/app/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))
#45 /var/www/app/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))
#46 /var/www/app/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#47 {main}
"}

Missing resource key: task_statuses_4 at /var/www/app/app/Jobs/Util/Import.php:1299

Should I have to remove from v4 task statuses made by me, before do migration?