Deserializing error migrating from v4 to v5

I am trying to migrate from a v4 installation on one server to another running v5 using docker-compose. The initial setup of v5 works well, but after starting the migration on my v4 instance I get locked out of the v5 server because of the following error on the login page:


Any idea how to debug this?

Hi @flofeld

I have made a change to both the V4 master branch and V2 branch which contains fixes for this.

You can try remigrating and it should work.

Thanks @david

I have let some time pass and today I updated my v4 instance to 4.5.21 and set up a new v5 instance running 5.0.25 and the good news is the error does not occure anymore. I get no error but after I start the migration there seems to be nothing happening afterwards.

What should I do? Migrate manually?

Edit: I got this from the nginx logs:

POST /api/v1/migration/start/VolejRejNm HTTP/1.1" 404 58 “-” “unirest-php/2.0”

Could it be a problem that I am migrating to a docker instance?

It sounds like your queue is not running?

you could try

php artisan queue:restart

or in your .env file change


make sure to run

php artisan optimize



now the migration on the v4 instance is stuck on the auth step and nginx logs:

“POST /api/v1/login?include=token HTTP/1.1” 403 51 “-” “unirest-php/2.0”

403 indicates a permission error. Do you have the account setup on the v5 side yet?

you’ll need to create an account with the same username/password combo as your V4 setup

@david getting closer, bear with me please

I tried to login on the v5 instance again and now I get the following error:

403: Error: {“message”:“Invalid secret”,“errors”:{}}

I guess secret is not the password but the optional one below the url on the login form. I left it empty before and I am not aware of setting one by running the artisan commands. Any idea?

This is an easy one, edit the .env file and remove the line


then run

php artisan optimize

and try again.

@david the only thing close I have defined is APP_KEY and I thought I need that one. I have tried to echo $API_SECRET in the docker container and it returns nothing.

I deleted the containers and data, started over to be sure, restarted the queue and ran optimize and now I get the 404 again…

“POST /api/v1/migration/start/VolejRejNm HTTP/1.1” 404 58 “-” “unirest-php/2.0”

after trying it a couple of times I now get the 403 and am again locked out of the v5 instance. Where and how could the secret get set?!

Hi @david and @flofeld, I jump into the thread because I have the exact same behavior (though it’s not a docker install).

“POST /api/v1/migration/start/VolejRejNm HTTP/1.1” 404 3912 “-” “unirest-php/2.0”

I have tried everything I could without success.

@Steph @flofeld

Can you try updating your V4 (msater branch) and V5 (v5-develop branch) code to the latest from GitHub please. There are fixes in there for most of these issue.

Please let me know if the issue persists.

Thanks @david. It helped indeed. The migration started, but in my case it failed when (or after) importing tasks.
Also, I cannot log into v5 anymore (401 error: these credentials do not match our records).

[2020-11-23 07:43:08] production.INFO: Importing tasks  
[2020-11-23 07:43:08] production.INFO: Missing resource key: projects_2  
[2020-11-23 07:43:09] production.ERROR: Missing resource key: projects_2 {"userId":1,"exception":"[object] (Exception(code: 0): Missing resource key: projects_2 at /var/www/invoiceninja5/app/Jobs/Util/Import.php:1215)
#0 /var/www/invoiceninja5/app/Jobs/Util/Import.php(1077): App\\Jobs\\Util\\Import->transformId()
#1 /var/www/invoiceninja5/app/Jobs/Util/Import.php(194): App\\Jobs\\Util\\Import->processTasks()
#2 /var/www/invoiceninja5/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\Import->handle()


It looks like the import broke the V5 app.

I haven’t seen the issue with projects. If you still have the v5 database, can you check that the project table has been populated?

@david Yes it has been populated (and fully migrated - I only have 2 projects in it)




I’ll need to setup a test environment to try and recreate this. I think it may be because the project has been deleted, but i’m not 100% sure. I’ll update here when i solve this one.

That’s right. Both projects have been deleted.