Best Way to migrate to V5

This isn’t broken, all versions of the mobile app require a trusted cert. We suggest using Let’s Encrypt.

@hillel i am using a trusted cert but not public trusted cert, the CA signed the cert is trusted by my phone, i believe you mentioned to me in another conversation that the mobile app is using it is own store for trusted cert and doesn’t leverage the phone.

When i access the browser using https it doesn’t complain about it because it is being trusted by my computer.

Also i remember you advised me to test v5. The problem i am using the application with a local domain name that i cannot generate a letsencrypt cert for it.

I am referring to this topic:

Right, I remember now.

@david what do you think, should there be an option in the mobile app to allow an untrusted cert?

@gerootech to make this work, you may need to add the root CA that you used to create the self signed certificate to your phones SSL store. The trust issue occurs well outside the bounds of the application so there isn’t anything for us to fix.

@david It is already added to the root cert of my phone but still getting the error invalid handshake. I have other applications (bitwarden) using the same CA with no issues.

When i try the new invoice ninja v5 on my android phone i get the following error:

HandshakeException: Handshake error in client (OS Error:
CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:354))

@gerootech right, so the app isn’t prompting to trust the cert.

@hillel to make this work, we’d need to ask the app to dive in and prompt to trust the cert, unsure how difficult this would be cross platform in flutter.

https://developer.android.com/training/articles/security-ssl#CommonProblems

I believe Flutter/Dart provides a way to ignore the cert check, I think this ‘feature’ would need to be opted in to

@david and @hillel How can i report issues i find with the beta.

I have 2 companies with 2 users for both.

i have created the first user and i am able to login to it with no issues. however when i create the 2nd user i cannot login using this second account no matter what.

When i try to edit this specific user, it displays a grey blank window, so i cannot edit it at all.
When i try to remove the account, after i enter my password, if i clic on submit it get request denied, but if i hit enter on my keyboard instead it does delete the account and the pop up window with the password confirmations stays on the screen.

Also each time i try to migrate i get a page saying something wrong happened (v 4.5.21)
after migrating to v4.5.23 i am getting the following error:
Error: Make sure you did proper setup with V5 of Invoice Ninja, before starting migration.

@gerootech

V 5.0.35 should address the user edit issue. When you create a new user an invitation link is sent, you need to use this invitation to login for the first time.

In regards to failing migrations, you’d want to check the logs for the reported errors.

I am looking at the storage/logs/larval-error.log and found the follwoing:

[2020-12-11 14:42:44] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError [0] : /var/www/html/ninja/app/Traits/GenerateMigrationResources.php [Line 1101] => Call to a member function toDateString() on string {“context”:“PHP”,“user_id”:5,“account_id”:5,“user_name”:“My NAme”,“method”:“POST”,“user_agent”:“Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36”,“locale”:“en”,“ip”:“My_IP_ADDRESS”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“migration/companies”} []

Also upgrading to v5.0.35 gives me this error in apache logs:

[Fri Dec 11 18:52:00.557588 2020] [php7:error] [pid 329932] [client 10.1.1.70:58885] PHP Fatal error: Uncaught ReflectionException: Class translator does not exist in /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php:830\nStack trace:\n#0 /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(830): ReflectionClass->__construct(‘translator’)\n#1 /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(712): Illuminate\Container\Container->build(‘translator’)\n#2 /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\Container\Container->resolve(‘translator’, Array, true)\n#3 /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Foundation\Application->resolve(‘translator’, Array)\n#4 /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\Container\Container->make(‘translator’, Array)\n#5 /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(119): Illu in /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 832, referer: https://in5.ghf.loc/flutter_service_worker.js?v=5.0.33

you may need to delete the files in bootstrap/cache

and then do

composer dump

I did this and it cleared all my current configurations, i have to start setup from scatch. Not a big deal though.

However i would like to know what is wrong with my migration steps, i had the errors pasted before the upgrade error.

[2020-12-11 14:42:44] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError [0] : /var/www/html/ninja/app/Traits/GenerateMigrationResources.php [Line 1101] => Call to a member function toDateString() on string {“context”:“PHP”,“user_id”:5,“account_id”:5,“user_name”:“My NAme”,“method”:“POST”,“user_agent”:“Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36”,“locale”:“en”,“ip”:“My_IP_ADDRESS”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“migration/companies”} []

@gerootech you shouldn’t have lost anything clearing that cache folder. composer dump would have rebuilt the cache.

Can you paste linen 1101 from the GenerateMigrationResources.php file in your V4 installation? (it should be located in App\Traits you may have old code there.

This is the code starting line 1100

private function getTaskStatuses()
{
$task_statuses = TaskStatus::where(‘account_id’, $this->account->id)->withTrashed()->get();

    if($task_statuses->count() == 0)
    {
        $defaults = [
            'backlog',
            'ready_to_do',
            'in_progress',
            'done',
        ];
        for ($i=0; $i<count($defaults); $i++) {
            $status = TaskStatus::createNew();
            $status->name = trans('texts.' . $defaults[$i]);
            $status->sort_order = $i;
            $status->save();
        }

        $task_statuses = TaskStatus::where('account_id', $this->account->id)->withTrashed()->get();

    }

    $transformed = [];

    foreach($task_statuses as $task_status)
    {
        $transformed[] = [
            'name' => $task_status->name ?: '',
            'id' => $task_status->id,
            'company_id' => $this->account->id,
            'user_id' => $task_status->user_id,
            'status_sort_order' => $task_status->sort_order,
            'is_deleted' => false,
            'created_at' => $task_status->created_at ? Carbon::parse($task_status->created_at)->toDateString() : null,
            'updated_at' => $task_status->updated_at ? Carbon::parse($task_status->updated_at)->toDateString() : null,
            'deleted_at' => $task_status->deleted_at ? Carbon::parse($task_status->deleted_at)->toDateString() : null,
        ];
    }

    return $transformed;

}

So that is the confusing thing, line 1101 doesn’t reference the error you are seeing, (it should be a Carbon date modifier, which there isn’t)

You may want to try running php artisan queue:restart on V4 to see if the migration job needs to be refreshed and try migrating again.

ok, will try this soon, however is there a way to reset the V5 to factory defaults again ?

@gerootech What do you mean by factory defaults?

If you mean just the codebase then switching to the v5-stable branch will track our releases.

i mean i need to clear all the configuration i did for the v5 installation and start the setup configuration from the scratch as if it is net new installation.

@gerootech yeh, just switch to v5-stable

git checkout v5-stable
git pull