Whoops - Migration 4.5.37 > v5.4.4-C85

Hi there.

The third attempt at Migration failed. This time using the latest version v5.4.4-C85.

Whoops, looks like something went wrong. Can anyone point out the problem?

Thank you.

Blockquote (1/1) DecryptException

The MAC is invalid.
in Encrypter.php line 195
at Encrypter->getJsonPayload(array(‘iv’ => ‘tW0TOzedxJY5B3Fcih9hQQ==’, ‘value’ => ‘B70leZdMN+N6NUdPHRem7WIrvEbsVy49avqTZm3P7vg1mh66cTxY/TtjQSdDO3lzlEQvUVcUe3gYTW6mYshyn+t8GR0z/qIDYqP4ZPE0X/xqKpLx2klep3JhaaZePqt7NhanjN/W8ncEm70Jw3FVMk+/GMTdQA5KyFkPWpWY9FiI06aMVOh6nmDk8dXxe5w3fyl14a5uJSnfkc71y3XGKWCYyyNBYGFMKkCVeCKCDCwCoGNfLZQBtLpUHY68TBqoThvSNSW2KzYJRNNJDLQLMLhYXoyq1Pt4Ym5SCtO3mFGoFcvfgKgSv0vXtBLybObQZ3VqkrvlCbqJVoMGM/6L93ZOSPdb5Sa7fBlV3CUR53w=’, ‘mac’ => ‘0538880affbed6ae710b9d49f47fd94d46f2328f2357e13f451c5f506adcd6d2’))in Encrypter.php line 134
at Encrypter->decrypt(‘eyJpdiI6InRXMFRPemVkeEpZNUIzRmNpaDloUVE9PSIsInZhbHVlIjoiQjcwbGVaZE1OK042TlVkUEhSZW03V0lydkVic1Z5NDlhdnFUWm0zUDd2ZzFtaDY2Y1R4WVwvVHRqUVNkRE8zbHpsRVF2VVZjVWUzZ1lUVzZtWXNoeW4rdDhHUjB6XC9xSURZcVA0WlBFMFhcL3hxS3BMeDJrbGVwM0poYWFaZVBxdDdOaGFuak5cL1c4bmNFbTcwSnczRlZNaytcL0dNVGRRQTVLeUZrUFdwV1k5RmlJMDZhTVZPaDZubURrOGRYeGU1dzNmeWwxNGE1dUpTbmZrYzcxeTNYR0tXQ1l5eU5CWUdGTUtrQ1ZlQ0tDREN3Q29HTmZMWlFCdExwVUhZNjhUQnFvVGh2U05TVzJLellKUk5OSkRMUUxNTGhZWG95cTFQdDRZbTVTQ3RPM21GR29GY3ZmZ0tnU3Ywdlh0Qkx5Yk9iUVozVnFrcnZsQ2JxSlZvTUdNXC82TDkzWk9TUGRiNVNhN2ZCbFYzQ1VSNTN3PSIsIm1hYyI6IjA1Mzg4ODBhZmZiZWQ2YWU3MTBiOWQ0OWY0N2ZkOTRkNDZmMjMyOGYyMzU3ZTEzZjQ1MWM1ZjUwNmFkY2Q2ZDIifQ==’)in Facade.php line 221
at Facade::__callStatic(‘decrypt’, array(‘eyJpdiI6InRXMFRPemVkeEpZNUIzRmNpaDloUVE9PSIsInZhbHVlIjoiQjcwbGVaZE1OK042TlVkUEhSZW03V0lydkVic1Z5NDlhdnFUWm0zUDd2ZzFtaDY2Y1R4WVwvVHRqUVNkRE8zbHpsRVF2VVZjVWUzZ1lUVzZtWXNoeW4rdDhHUjB6XC9xSURZcVA0WlBFMFhcL3hxS3BMeDJrbGVwM0poYWFaZVBxdDdOaGFuak5cL1c4bmNFbTcwSnczRlZNaytcL0dNVGRRQTVLeUZrUFdwV1k5RmlJMDZhTVZPaDZubURrOGRYeGU1dzNmeWwxNGE1dUpTbmZrYzcxeTNYR0tXQ1l5eU5CWUdGTUtrQ1ZlQ0tDREN3Q29HTmZMWlFCdExwVUhZNjhUQnFvVGh2U05TVzJLellKUk5OSkRMUUxNTGhZWG95cTFQdDRZbTVTQ3RPM21GR29GY3ZmZ0tnU3Ywdlh0Qkx5Yk9iUVozVnFrcnZsQ2JxSlZvTUdNXC82TDkzWk9TUGRiNVNhN2ZCbFYzQ1VSNTN3PSIsIm1hYyI6IjA1Mzg4ODBhZmZiZWQ2YWU3MTBiOWQ0OWY0N2ZkOTRkNDZmMjMyOGYyMzU3ZTEzZjQ1MWM1ZjUwNmFkY2Q2ZDIifQ==’))in GenerateMigrationResources.php line 1293
at StepsController->getCompanyGateways()in StepsController.php line 240
at StepsController->generateMigrationData(array(’_token’ => ‘cW7kyMJs5ZqPoSFhEaCuy4Un3gmMffcHL9KrnC9v’, ‘account_key’ => ‘XHc1QFVNpjfcolUSTzKOgBcrllVlgny9’, ‘companies’ => array(‘XHc1QFVNpjfcolUSTzKOgBcrllVlgny9’ => array(‘id’ => ‘XHc1QFVNpjfcolUSTzKOgBcrllVlgny9’, ‘force’ => ‘on’), ‘zlnioc8ksbhxcooznxjbvowrywcdnxs5’ => array(‘id’ => ‘zlnioc8ksbhxcooznxjbvowrywcdnxs5’, ‘force’ => ‘on’))))in StepsController.php line 172
at StepsController->handleCompanies(object(MigrationCompaniesRequest))
at call_user_func_array(array(object(StepsController), ‘handleCompanies’), array(object(MigrationCompaniesRequest)))in Controller.php line 54
at Controller->callAction(‘handleCompanies’, array(object(MigrationCompaniesRequest)))in ControllerDispatcher.php line 45
at ControllerDispatcher->dispatch(object(Route), object(StepsController), ‘handleCompanies’)in Route.php line 212
at Route->runController()in Route.php line 169
at Route->run()in Router.php line 658
at Router->Illuminate\Routing{closure}(object(Request))in Pipeline.php line 30
at Pipeline->Illuminate\Routing{closure}(object(Request))in EligibleForMigration.php line 19
at EligibleForMigration->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in Authenticate.php line 122
at Authenticate->handle(object(Request), object(Closure), ‘user’)in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in DatabaseLookup.php line 21
at DatabaseLookup->handle(object(Request), object(Closure), ‘user’)in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in StartupCheck.php line 241
at StartupCheck->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in QueryLogging.php line 32
at QueryLogging->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in DuplicateSubmissionCheck.php line 41
at DuplicateSubmissionCheck->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in VerifyCsrfToken.php line 68
at VerifyCsrfToken->handle(object(Request), object(Closure))in VerifyCsrfToken.php line 44
at VerifyCsrfToken->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in StartSession.php line 63
at StartSession->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in EncryptCookies.php line 68
at EncryptCookies->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in Pipeline.php line 102
at Pipeline->then(object(Closure))in Router.php line 660
at Router->runRouteWithinStack(object(Route), object(Request))in Router.php line 635
at Router->runRoute(object(Request), object(Route))in Router.php line 601
at Router->dispatchToRoute(object(Request))in Router.php line 590
at Router->dispatch(object(Request))in Kernel.php line 176
at Kernel->Illuminate\Foundation\Http{closure}(object(Request))in Pipeline.php line 30
at Pipeline->Illuminate\Routing{closure}(object(Request))in InjectDebugbar.php line 51
at InjectDebugbar->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in HandlePreflight.php line 46
at HandlePreflight->handle(object(Request), object(Closure))in Pipeline.php line 149
at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request))in Pipeline.php line 102
at Pipeline->then(object(Closure))in Kernel.php line 151
at Kernel->sendRequestThroughRouter(object(Request))in Kernel.php line 116
at Kernel->handle(object(Request))in index.php line 51

Blockquote

Hi,

The v4 app is out of date, the latest version is v4.5.50.

Thank you for your prompt reply Hillel.

I updated it to v4.5.50. Upgraded PHP to 7.4 and lifter memory limit to 256Mb.

Now I get “The MAC is invalid.”

Br,
Dali

Hm, after upgrading to 4.5.50, Add Gateway page seems to fail.

Class ‘\Omnipay\Cybersource\Gateway’ not found

(1/1) RuntimeException

Class ‘\Omnipay\Cybersource\Gateway’ not found
in GatewayFactory.php line 105
at GatewayFactory->create()
at call_user_func_array()in Omnipay.php line 115
at Omnipay::__callStatic()in Gateway.php line 217
at Gateway->getFields()in AccountGatewayController.php line 138
at AccountGatewayController->getViewModel()in AccountGatewayController.php line 95
at AccountGatewayController->create()in Controller.php line 54
at Controller->callAction()in ControllerDispatcher.php line 45
at ControllerDispatcher->dispatch()in Route.php line 219
at Route->runController()in Route.php line 176
at Route->run()in Router.php line 681
at Router->Illuminate\Routing{closure}()in Pipeline.php line 130
at Pipeline->Illuminate\Pipeline{closure}()in PermissionsRequired.php line 53
at PermissionsRequired->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in Authenticate.php line 122
at Authenticate->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in DatabaseLookup.php line 21
at DatabaseLookup->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in StartupCheck.php line 240
at StartupCheck->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in QueryLogging.php line 32
at QueryLogging->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in DuplicateSubmissionCheck.php line 41
at DuplicateSubmissionCheck->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in TransformsRequest.php line 21
at TransformsRequest->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in VerifyCsrfToken.php line 78
at VerifyCsrfToken->handle()in VerifyCsrfToken.php line 44
at VerifyCsrfToken->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in StartSession.php line 56
at StartSession->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in EncryptCookies.php line 67
at EncryptCookies->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in Pipeline.php line 105
at Pipeline->then()in Router.php line 683
at Router->runRouteWithinStack()in Router.php line 658
at Router->runRoute()in Router.php line 624
at Router->dispatchToRoute()in Router.php line 613
at Router->dispatch()in Kernel.php line 170
at Kernel->Illuminate\Foundation\Http{closure}()in Pipeline.php line 130
at Pipeline->Illuminate\Pipeline{closure}()in InjectDebugbar.php line 67
at InjectDebugbar->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in CheckForMaintenanceMode.php line 63
at CheckForMaintenanceMode->handle()in Pipeline.php line 171
at Pipeline->Illuminate\Pipeline{closure}()in Pipeline.php line 105
at Pipeline->then()in Kernel.php line 145
at Kernel->sendRequestThroughRouter()in Kernel.php line 110
at Kernel->handle()in index.php line 53

@david any thoughts on the MAC error?

For the Cybersource error please check payment_library_id is set to 2 in the gateways table. You may be able to correct it by loading /update (or /public/update).

For the Cybersource error please check payment_library_id is set to 2 in the gateways table.

That fixed it yes, thx!!!

You may be able to correct it by loading /update (or /public/update).

Hm, that gives me an error (Undefined property: stdClass::$engine) but I don’t think this is now relevant. I’m just trying to get migration working.

The MAC is invalid problem still persists.

Dali

Thank you
Br,

Hi Hillel.

That was my third attempt to migrate from different versions. Each time I spent many hours trying to get it right and it always stops like this. I would like to go to v5 and use new features.

What are my options now?

Do you offer a paid support?

Should I start from the scratch and leave v4 instance for past invoices?

Thank you

Br,
Dali

Are you able to edit the payment gateways in v4, I think the MAC error is likely from invalid data in the v4 app.

One option is to export/import data as CSV.

Hi.

Thank you for your reply

Yes, after your trick by editing the database.
payment_library_id is set to 2

I tried to delete all gateways, still the same.

Can not export CSV. It works for Clients, but not for Invoices and payments. It does not execute the download.

Thx

Br,
Dali

An update.

It will export all other CSVs, but not Invoices.

When I try to export CSV Invoices it opens /exports and says:
Invoice Ninja v4.5.50 - 22.06.2022 23:31 INVOICES

…but will not download anything.

2022-06-22_233323

Also, in expenses, I have lots of PDF attachments. What happens with those?

Thank you

Are there any errors in the logs?

You would need to use the migration tool to automatically brig over documents.

Thank you for your reply Hillel.

The only log that outputs something is laravel-info.log

laravel-info.log

[2022-06-23T08:28:54.193060+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.194447+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.195862+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.197262+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.198638+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.200072+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.201518+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.202995+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.204449+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.205951+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.207406+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.208857+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.210270+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.211794+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.213206+00:00] production.INFO: Importing contacts => 1 [] []
[2022-06-23T08:28:54.217653+00:00] production.INFO: get get company gateways => 17 [] []
[2022-06-23T08:28:54.217699+00:00] production.INFO: translating gateway ID = 17 [] []
[2022-06-23T08:28:54.218115+00:00] production.INFO: translating gateway ID = 17 [] []
[2022-06-23T08:28:54.218221+00:00] production.INFO: get transform fees and limits [] []
[2022-06-23T08:28:54.218714+00:00] production.INFO: translating gateway ID = 18 [] []
[2022-06-23T08:28:54.219033+00:00] production.INFO: translating gateway ID = 18 [] []
[2022-06-23T08:28:54.219113+00:00] production.INFO: get transform fees and limits [] []
[2022-06-23T08:28:54.219519+00:00] production.INFO: translating gateway ID = 17 [] []
[2022-06-23T08:28:54.219821+00:00] production.INFO: translating gateway ID = 17 [] []
[2022-06-23T08:28:54.219899+00:00] production.INFO: get transform fees and limits [] []
[2022-06-23T08:28:54.220320+00:00] production.INFO: translating gateway ID = 62 [] []
[2022-06-23T08:28:54.220647+00:00] production.INFO: translating gateway ID = 62 [] []
[2022-06-23T08:28:54.220726+00:00] production.INFO: get transform fees and limits [] []
[2022-06-23T08:28:54.221103+00:00] production.INFO: translating gateway ID = 18 [] []
[2022-06-23T08:28:54.221427+00:00] production.INFO: translating gateway ID = 18 [] []
[2022-06-23T08:28:54.221508+00:00] production.INFO: get transform fees and limits [] []
[2022-06-23T08:28:54.221894+00:00] production.INFO: translating gateway ID = 62 [] []
[2022-06-23T08:28:54.222218+00:00] production.INFO: translating gateway ID = 62 [] []
[2022-06-23T08:28:54.222299+00:00] production.INFO: get transform fees and limits [] []
[2022-06-23T08:28:54.222718+00:00] production.INFO: translating gateway ID = 61 [] []
[2022-06-23T08:28:54.223416+00:00] production.INFO: The MAC is invalid. [] []

Clearly, it happens on
Gateway ID = 61 (Braintree)
or just after
Gateway ID = 62 (Custom)


Thank you
Br,
Dali

Thanks for the details!

@david do you have any thoughts?

mac is invalid = app_key has been rotated and is now unable to decrypt anything encrypted in the application.

you’ll need to restore your .env to the original with the correct APP_KEY

Do you have Braintree enabled in your account?

Hi Hillel and David.

Do you have Braintree enabled in your account?

Yes, I have Braintree enabled. But I tried to delete both Gateways and after Migration still failed.

you’ll need to restore your .env to the original with the correct APP_KEY

I might change the APP_KEY in the past for some reason (don’t remember now) and I don’t have it now. What to do now?

Thank you

Br,
Dali

Did you delete the gateway in the app or from the database?

You may need to do the latter but definitely make a db backup first.

In the app

Thx

Br,
Dali

Ok, deleting in the db may help. Note: this will delete any directly linked data, ie. payments made with the gateway. It may also work to clear the gateway config.

@david can you please check that the migration skips deleted company gateways.

@hillel

Not possible to skip deleted gateways as there will be foreign key constraints linked to old records that need to be preserved.