Migration Memory Error

Hello. When I try to migrate to v5 I get a “Whoops, looks like something went wrong” page.

The v4 laravel-error.log file has this in it:

[2020-12-18 22:36:51] production.ERROR: ***Symfony\Component\Debug\Exception\FatalErrorException*** [1] : /var/www/html/invoiceninja/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php [Line 142] => Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) {"context":"PHP","user_id":1,"account_id":1,"user_name":"name","method":"POST","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0","locale":"en","ip":"10.1.2.12","count":1,"is_console":"no","is_api":"no","db_server":"mysql","url":"migration/companies"} []

Edit:
Sorry, after setting memory_limit in my php.ini file to 4096M the error is gone and I now see “Migration has started. We’ll update you with status, on your company e-mail.”

Edit2:
I left it running for 5+ hours and it doesn’t look like anything has been transferred.

Our customer DB is very large. Is this causing the problem? Are there other memory limits I should increase?

Hey there… 5 hours definitely shouldn’t be a normal behaviour.

Can you check your v5 logs?

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

Thanks!

Okay I think this might be where the migration is failing. Any idea how I can correct this? Or find the payment it is referencing? I checked our payments and did not find a $15 one on 5/21. Also, I looked in the database under clients and payments and cannot find a reference to client_id 17755. Ours seem to be numbered from 24264-34122. What do these numbers normally start at? I originally imported our clients in the v4 instance from a csv file.

[2020-12-19 19:25:29] production.INFO: Importing payments
[2020-12-19 19:26:23] production.INFO: payment with no status id?
[2020-12-19 19:26:23] production.INFO: Array
(
[client_id] => 17755
[user_id] => 1
[company_id] => 4
[is_deleted] => 0
[amount] => 15.00
[applied] => 0
[refunded] => 0
[date] =>
[created_at] => 2020-05-21
[updated_at] => 2020-05-21
[deleted_at] =>
)

[2020-12-19 19:26:23] production.INFO: Undefined index: status_id
[2020-12-19 19:26:23] production.ERROR: Undefined index: status_id {“userId”:1,“exception”:"[object] (ErrorException(code: 0): Undefined index: status_id at /var/www/html/invoiceninja/app/Repositories/Migration/PaymentMigrationRepository.php:94)
[stacktrace]

hi @in_user_2020 the error

payment with no status id?

has been resolved in the latest versions of v4 and v5. Bring both your v4 and v5 apps to the latest releases and this issue should be resolved.

1 Like

Thanks.
The previous migration did complete at some point. I did not realize that it created an additional company in v5. (I needed to select it from the drop down).

I am currently at v4.5.24 and v5.0.38-C31
I purged the v5 DB, deleted the extra company, and ran the migration again.

I got the same error but this time the client_id is 27606

[2020-12-21 15:36:16] production.INFO: Importing payments
[2020-12-21 15:37:10] production.INFO: payment with no status id?
[2020-12-21 15:37:10] production.INFO: Array
(
[client_id] => 27606
[user_id] => 1
[company_id] => 5
[is_deleted] => 0
[amount] => 15.00
[applied] => 0
[refunded] => 0
[date] =>
[created_at] => 2020-05-21
[updated_at] => 2020-05-21
[deleted_at] =>
)

[2020-12-21 15:37:10] production.INFO: Undefined index: status_id
[2020-12-21 15:37:10] production.ERROR: Undefined index: status_id {“userId”:1,“exception”:"[object] (ErrorException(code: 0): Undefined index: status_id at /var/www/html/invoiceninja/app/Repositories/Migration/PaymentMigrationRepository.php:94)
[stacktrace]

I cannot find this $15 payment on 5/21 in the payments table of the DB.

Hey there,

In your v4 storage directory, you’ll be able to find the ZIP archive with your migration. Can you open it? It should be just one huge text file (JSON to be precise).

Open it in your prefered text editor and search for 27606 (client_id) or 2020-05-21 (created_at). Are you able to find that record? If so, can you check does it have status_id?

Thanks.