InternalExtensibilityError error when trying to create a user

Problem statement

When trying to create a user by calling the POST /dbconnections/signup endpoint, we received the below error

{
"name": "InternalExtensibilityError",
"statusCode": 400,
"code": "extensibility_error",
"message": "Last name longer than 80 characters",
"friendly_message": "Invalid last_name Format",
"description": "Last name longer than 80 characters",
"fromSandbox": true
}

Cause

The error name “InternalExtensibilityError” suggests it comes from the hooks or actions (pre or post user registration).

Searching the error message “Last name longer than 80 characters” in hooks and actions, it can be confirmed that the error is thrown from a “Pre User Registration” action. Here is the code snippet that throws this error:

Solution

Fix the scripts in the create-metadata “Pre User Registration” action.