Issue field DEDUPE "0 Argument 1 passed to"
We are experiencing a similar type error on staging site running 5.21

-we have created a custom field in the civicrm profile used for site registration, e.g. that matches on a unique identifier (card Number)

-The error we are getting looks likes this :

TypeError: Argument 1 passed to civicrm_api3() must be of the type string, null given, called in /home/ibew90v2/master/sites/all/modules/civicrm/CRM/Dedupe/BAO/Rule.php on line 62 in civicrm_api3() (line 84 of /home/ibew90v2/master/sites/all/modules/civicrm/api/api.php).
ERROR
The website encountered an unexpected error. Please try again later.  

The error appears to state that it is looking for null value (?) and cannot handle any input (alphanumeric or otherwise in the field)
Placing nothing in the custom field it allows the profile submission and creates the account.

The latest release notes here reference a change to the api https://github.com/civicrm/civicrm-core/blob/master/release-notes/5.21.0.md
https://github.com/civicrm/civicrm-core/pull/15817

"Fixes a formatting issue in the api explorer output where IS NULL and IS NOT NULL clauses would output invalid code due to the missing value piece of the clause."
it appears that the api did not update, somehow when doing the upgrade, that it is still referencing the apiv3 folder .

Notes :

first part of the error references line 66 in the rule.php file, e.g. /home/ibew90v2/master/sites/all/modules/civicrm/api/v3/Rule.php
"This api exposes CiviCRM (dedupe) rules."

The second part of the error references the api.php file at /home/ibew90v2/master/sites/all/modules/civicrm/api/api.php
it is breaking down here, line 84 : 
 function civicrm_api3(string $entity, string $action, array $params = []) {  $params['version'] = 3;

However 5.21 per release notes is using api v4 -- are these old files ? need to be replaced or updated?

Possible fix here : https://github.com/civicrm/civicrm-core/pull/15817/files