SodiumChachaIetf::decrypt() must be of the type string, boolean

Go to Below file:

vendor/magento/framework/Encryption/Adapter/SodiumChachaIetf.php

And Update Below Code:

$plainText = sodium_crypto_aead_chacha20poly1305_ietf_decrypt(
            $payload,
            $nonce,
            $nonce,
            $this->key
        );
        if ($plainText == false)
        {
          return "";
        }
        return $plainText;

Looks like you are using the wrong crypt key.

You should keep the key from your previews configuration:

app/etc/local.xml [Magento 1.x]

<?xml version="1.0"?>
<config>
  <global>
    <install>
      <date>{{date}}</date>
    </install>
    <crypt>
       <key>123456_same_old_key_7890</key>
    </crypt>
[...]

And replace the new one in the new project:

app/etc/env.php [Magento 2.x]

<?php
[...],
'crypt' => [
    'key' => '123456_same_old_key_7890'
],
[...]

Source: https://github.com/magento/magento2/issues/19590


Modifying the core class is not recommended at all. The issue is not with the class vendor/magento/framework/Encryption/Adapter/SodiumChachaIetf.php

But the issue with the crypt key added to your app/etc/env.php

The reason of this issue is the crypt key is mismatched. You must have taken the database dump from any other instance and trying to run with your current instance. So along with database you need to get the crypt key from the same setup where from you got the db dump.

Just update the crypt key in env.php and it will work fine.

The fix is to use same crypt key of the installation from where db is being used.

Hope it is explained.

Mark me up if was helpful. Happy coding..!!