V4 to v5 - "check-data" and migration error

While preparing to migrate from v4 (4.5.38) to v5 (5.1.53-C47), when I run php artisan ninja:check-data, I get the following:

2021-04-24 05:15:14 2021-04-24 05:15:14 Running CheckData...
2021-04-24 05:15:14 0 activities with blank invoice backup
2021-04-24 05:15:14 0 clients with incorrect paid to date
2021-04-24 05:15:14 0 draft sent invoices
2021-04-24 05:15:14 0 invoices with incorrect balances
2021-04-24 05:15:14 0 clients with incorrect balance/activities
2021-04-24 05:15:14 0 contacts without a contact_key
2021-04-24 05:15:14 0 clients without any contacts
2021-04-24 05:15:14 0 clients without a single primary contact
2021-04-24 05:15:14 0 user accounts with multiple companies
2021-04-24 05:15:14 0 users with duplicate oauth ids
2021-04-24 05:15:14 0 failed jobs
2021-04-24 05:15:14 sq is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 bg is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 zh_TW is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 hr is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 cs is invalid: <p>Posílejte klientům stejné faktury týdně, dvakrát za měsíc, měsíčně, čtvrtletně nebo ročně. </p>
        <p>Použijte :MONTH, :QUARTER or :YEAR pro dynamicky měnící se datumy. Funguje zde i základní matematika například, jako  :MONTH-1.</p>
        <p>Příklady dynamických proměnných na faktuře:</p>
        <ul>
          <li>"Členství v posilovně za  :MONTH" => "Členství v posilovně za červenec"</li>
          <li>":YEAR+1 roční předplatné" => "2015 roční předplatné"</li>
          <li>"Platba za :QUARTER+1" => "Platba za Q2"</li>
        </ul>
2021-04-24 05:15:14 cs is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 da is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 nl is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 en is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 en_AU is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 en_GB is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 fi is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 fr is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 fr_CA is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 de is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 el is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 it is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 ja is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 lt is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 mk_MK is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 nb_NO is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 pl is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 pt_BR is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 pt_PT is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 ro is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 ru_RU is invalid: <p>Автоматически отправлять клиентам одни и те же счета-фактуры еженедельно, раз в два месяца, ежемесячно, ежеквартально или ежегодно.</p>
<p>Используйте :MONTH, :QUARTER или :YEAR для динамических дат. Базовая математика также работает, например, :MONTH-1.</p>
<p>Примеры динамических переменных счета:</p>
<ul>
<li>"Абонемент в спортзал на :MONTH" =>  "Абонемент в спортзал на июль"</li>
<li>":YEAR+1 годовая подписка" => "2015 годовая подписка"</li>
<li>"Вознаграждение за  :QUARTER+1 квартал" => "Вознаграждение за 2 квартал"</li>
</ul>
2021-04-24 05:15:14 ru_RU is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 sr_RS is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 sl is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 es is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 es_ES is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 sv is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 th is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 tr_TR is invalid: Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/docs/migration/#troubleshooting">https://invoiceninja.github.io/docs/migration/#troubleshooting</a>
2021-04-24 05:15:14 34 invalid text strings
2021-04-24 05:15:14 Done: FAILURE

Trying the migration anyway leads to “Whoops, looks like something went wrong.” Something seems to be wrong with the languages somehow, but I have been unable to figure out what to do about it – or whether it should even matter and my problem is elsewhere.

Hi,

The “invalid text strings” errors can be ignored. cc @david

Are there any details in storage/logs/ about the error?

The only new entry I can find after doing the data check, then attempting a migration, is:

[2021-04-24 19:24:24] production.ERROR: ***Illuminate\Contracts\Encryption\DecryptException*** [0] : /var/www/ninja/vendor/turbo124/framework/src/Illuminate/Encryption/Encrypter.php [Line 195] => The MAC is invalid.  {"context":"PHP","user_id":1,"account_id":1,"user_name":"(snip-name)","method":"POST","user_agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0","locale":"en","ip":"(snip-IP)","count":2,"is_console":"no","is_api":"no","db_server":"mysql","url":"migration/companies"} []

That error implies the value for APP_KEY in the .env file may have been changed at some point.

Thanks.

Any way around that? I don’t recall changing it, though I vaguely recall sometime in the past possibly having an issue with the .env file, so I suppose it’s possible. As far as I can tell, v4 continues to work fine and so long as I have the correct php version active all my newer and older data appears to show up fine. (I’m currently on php 7.3 and both v4 and v5 appear to independently be working.)

I have made some attempts using php artisan ninja:update-key but keep getting a “Encrypter.php line 195: The MAC is invalid.” error when doing so. I have not tried php artisan key:generate to try a new key yet, but I suppose that would be the next thing to try, unless I’m missing a known solution?

It may help to mark the records in the account_gateways table as archived/deleted

No luck. Tried deleting the gateways from within Invoice Ninja then trying, but got the same error. Then marked them as deleted with an SQL command which appeared to work when looking at the table data, but still getting the same error.

@david can we check for this in the migration to help track down the source of the problem

@hillel

We can put a pre-flight check in.

I backed up the problematic SQL file, then tried outright deleting all entries in the account_gateways table of the v4 installation, rather than merely marking them as deleted. I then attempted migration, and it appears to have worked, except that I did not receive an email notice.

However, upon logging in to v5 everything appears to be there.

FWIW there were some oddities which appear to be unrelated to the issue from the original post in this thread. I.e., when I first set up v5 I created a company of the same name I later migrated from v4, so upon migration I had two companies of the same name and had to delete the empty one. Then there were several minutes where it appeared I could not “save” changes to the migrated company – I think there may have been a cache issue or something, as there was an icon notice that the company was not activated, but it appeared that it was according to the toggle, and I could not save changes (such as deactivating & re-activating), but after several minutes this seemed to clear up on its own. I suspect something was confused about the two companies with the same name, until something caused a cache to clear/update. I’ll continue poking around but I think the migration worked.

Thanks!