"Extensibility Error" Displays Instead of Custom Error

Overview

This article explains why an “Extensibility Error” message displays instead of a custom error message when an Action does not properly capture and return errors.

Applies To

  • Actions

Cause

The “Extensibility Error” displays because the Action code does not utilize api.access.deny to capture and return specific errors. Instead, a generic error is thrown.

For example, the following code throws an extensibility error:

exports.onExecutePostLogin = async (event, api) => {
throw new Error("this is an error")
};

Solution

To ensure custom error descriptions display on the New Universal Login, implement api.access.deny within a try/catch block for proper error handling. This ensures that any errors occurring within the Action, such as those from requests the Action makes, trigger

api.access.deny() and display a custom error message to the user.

For example, the following code outputs the custom error to the New Universal Login:

exports.onExecutePostLogin = async (event, api) => {
try {
// Your Action logic here
} catch (error) {
api.access.deny("This is an error");
}
};

Related References