Migration 4.5.46-p2 to 5.5.103 fails


I am trying to migrate from self-hosted 4.5.46 to self-hosted 5.5.103 SC103.
Hosted on a kubernetes cluster, hence installed via the helm charts.
The official invoice ninja registry at docker hub does not seem to provide a newer (4.5.50) version hence we are stuck with 4.5.46.

All migrations fail with the error:

Attempt to read property "precision" on null
Attempt to read property "precision" on null

(that is, what the migration failed email says)

A zip file with the data in json format is uploaded to v5.
I don´t see any helpful info on the v4, so here is what could help from the v5:
invoiceninja.log contains

[2023-04-08 21:04:41] production.INFO: Starting Migration  
[2023-04-08 21:04:41] production.INFO: purging the existing company here  
[2023-04-08 21:04:41] production.INFO: starting migration job  
[2023-04-08 21:04:41] production.INFO: migrations/redacted-2023-04-08-invoiceninja.zip  
[2023-04-08 21:04:41] production.INFO: Inside Migration Job  
[2023-04-08 21:04:41] production.INFO: Starting Migration  
[2023-04-08 21:04:41] production.INFO: jerome@redacted.redacted  
[2023-04-08 21:04:41] production.INFO: Company ID =   
[2023-04-08 21:04:41] production.INFO: 7

The only other log we have is laravel-2023-04-08.log with this content

[2023-04-08 21:04:41] production.INFO: Importing account  
[2023-04-08 21:04:41] production.INFO: Importing company  
[2023-04-08 21:04:41] production.INFO: Importing users  
[2023-04-08 21:04:42] production.INFO: Importing payment_terms  
[2023-04-08 21:04:42] production.INFO: Importing tax_rates  
[2023-04-08 21:04:42] production.INFO: Importing clients  
[2023-04-08 21:04:47] production.INFO: Importing company_gateways  
[2023-04-08 21:04:47] production.INFO: Importing client_gateway_tokens  
[2023-04-08 21:04:47] production.INFO: Importing vendors  
[2023-04-08 21:04:49] production.INFO: Importing projects  
[2023-04-08 21:04:49] production.INFO: Importing products  
[2023-04-08 21:04:50] production.INFO: Importing credits  
[2023-04-08 21:04:50] production.INFO: Importing recurring_invoices

while some table seem to be imported there is only a single entry in invoices:
(just copying it in case it´s content causes this)

id	1
client_id	35
user_id	9
assigned_user_id	NULL
company_id	4
status_id	1
project_id	NULL
vendor_id	NULL
recurring_id	NULL
design_id	 2
number	KB-0001/2021-0001-deleted
discount	0.00
is_amount_discount	0
date	2021-10-04
last_sent_date	NULL
due_date	2021-10-08 00:00:00
is_deleted	1
line_items [{"quantity":1,"cost":4500,"product_key":"1 Stck.","notes":"Workshop \"redacted\"\r\nredacted","discount":0,"tax_name1":"","tax_rate1":0,"tax_name2":"","tax_rate2":0,"tax_name3":"","tax_rate3":0,"date":"2021-10-05","custom_value1":"","custom_value2":"","custom_value3":"","custom_value4":"","type_id":"1","product_cost":0,"is_amount_discount":false,"sort_id":"0","line_total":0,"gross_line_total":0,"tax_amount":0,"tax_id":""}]
backup	NULL
tax_rate1	0.000000
tax_rate2	0.000000
tax_rate3	0.000000
total_taxes	0.000000
uses_inclusive_taxes	0
next_send_date	NULL
custom_surcharge1 0.000000
custom_surcharge2	0.000000
custom_surcharge3	NULL
custom_surcharge4	NULL
custom_surcharge_tax1	0
custom_surcharge_tax2	0
custom_surcharge_tax3	0
custom_surcharge_tax4	0
exchange_rate	1.000000
amount	4500.000000
balance	4500.000000
partial	0.000000
partial_due_date	NULL
last_viewed	NULL
created_at	2021-10-04 00:00:00.000000
updated_at	2023-04-08 19:52:33.945362
deleted_at	2021-10-05 00:00:00.000000
reminder1_sent	NULL
reminder2_sent	NULL
reminder3_sent	NULL
reminder_last_sent	NULL
auto_bill_enabled 0
paid_to_date	0.000000
subscription_id	NULL
auto_bill_tries	0
is_proforma	0
tax_data	NULL

Now we are kind of clueless…any idea how to proceed? How to get more details why this crashes?

Thx…and btw happy easter everybody!


You’ll need to use the latest v4 version to migrate.

@david any thoughts why docker hub doesn’t have the latest version.


I’m not sure, we’ve tagged the release, i’ll try tagging again to see if it build.

30 Minute ago 4.5.51 showed up! But when running the container there seems to be an issue with either composer or the php version:

Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.33.

That latest v4 app requires PHP 7.4

Yes! But the container seems to run on PHP 7.3.33. This needs to be fixed before the docker container is build as far as I understand.

And by the way you are lightning fast! Incredible! Thx!

@david I build my own container for 4.5.51 changing the dockerfile.
(Cloned GitHub - invoiceninja/dockerfiles at 4.5.51 locally, updated alpine/4/dockerfile, ran docker build)


Using this container invoiceninja 4.5.51 runs as expected again.

However the migration results in the same errors:

   Attempt to read property "precision" on null
                Attempt to read property "precision" on null


[2023-04-09 08:13:16] production.INFO: Starting Migration  
[2023-04-09 08:13:16] production.INFO: purging the existing company here  
[2023-04-09 08:13:16] production.INFO: starting migration job  
[2023-04-09 08:13:16] production.INFO: migrations/hredacted8h3-2023-04-09-invoiceninja.zip  
[2023-04-09 08:13:18] production.INFO: Inside Migration Job  
[2023-04-09 08:13:18] production.INFO: Starting Migration  
[2023-04-09 08:13:18] production.INFO: jerome@...  
[2023-04-09 08:13:18] production.INFO: Company ID =   
[2023-04-09 08:13:18] production.INFO: 8 


2023-04-09 08:13:18] production.INFO: Importing account  
[2023-04-09 08:13:18] production.INFO: Importing company  
[2023-04-09 08:13:18] production.INFO: Importing users  
[2023-04-09 08:13:18] production.INFO: Importing payment_terms  
[2023-04-09 08:13:18] production.INFO: Importing tax_rates  
[2023-04-09 08:13:18] production.INFO: Importing clients  
[2023-04-09 08:13:24] production.INFO: Importing company_gateways  
[2023-04-09 08:13:24] production.INFO: Importing client_gateway_tokens  
[2023-04-09 08:13:24] production.INFO: Importing vendors  
[2023-04-09 08:13:26] production.INFO: Importing projects  
[2023-04-09 08:13:26] production.INFO: Importing products  
[2023-04-09 08:13:26] production.INFO: Importing credits  
[2023-04-09 08:13:26] production.INFO: Importing recurring_invoices  

@hillel so basically updating to the latest container did not change the migration, still failing with the same behaviour. Any other idea what could be causing this?

The error here is in v5, not v4, The cache doesn’t appear to have been built, you could try to run /update?secret= in v5 and then reattempt the migration.

@david same result. Is there another way to rebuild the cache?

hmmm, just to note when updating the cache via the URL, the query parameter ?secret= has the value of whatever is set in your default .env file UPDATE_SECRET

if it is blank, i am unsure why your system is not writing to the cache. I am assuming in your config you are using Redis for cache?

So, the default secret was set to “secret” once I figured this out, the migration worked like a charm!

@david @hillel thank you for your support!

1 Like

There is one more issue with the last company that we migrate:

 Undefined array key "notifications"
                Undefined array key "notifications"

The logs:

~ $ tail -n100 storage/logs/laravel-2023-04-11.log 
[2023-04-11 08:22:11] production.INFO: Importing account  
[2023-04-11 08:22:11] production.INFO: Importing company  
[2023-04-11 08:22:11] production.INFO: Importing users  
[2023-04-11 08:33:19] production.INFO: Importing account  
[2023-04-11 08:33:19] production.INFO: Importing company  
[2023-04-11 08:33:19] production.INFO: Importing users  
~ $ tail -n100 storage/logs/invoiceninja.log 
[2023-04-11 08:33:19] production.INFO: Starting Migration  
[2023-04-11 08:33:19] production.INFO: purging the existing company here  
[2023-04-11 08:33:19] production.INFO: starting migration job  
[2023-04-11 08:33:19] production.INFO: migrations/redacted-2023-04-11-invoiceninja.zip  
[2023-04-11 08:33:19] production.INFO: Inside Migration Job  
[2023-04-11 08:33:19] production.INFO: Starting Migration  
[2023-04-11 08:33:19] production.INFO: redacted@redacted
[2023-04-11 08:33:19] production.INFO: Company ID =   
[2023-04-11 08:33:19] production.INFO: 15  

Any hint?