Failed Login with Error "Cannot find module..."

Overview

A common error can occur when an unsupported node module is being used in a Rule or Hook or a dependency has not been added in an Action.  Logins will fail with the error beginning like this:

Cannot find module...

 

Applies To

  • Node Module
  • Actions 
  • Hooks
  • Rules

Cause

An unsupported Node module is being used in an Action, or a dependency has not been added to the Dependencies section of the action.

Also, do not require a dependency with the version suffix in the code itself, as it can lead to versioning issues.

It is recommended to change the action code from: 

const ManagementClient = require("auth0@4.3.1").ManagementClient; 

to 

const ManagementClient = require("auth0").ManagementClient;

 The version of the Auth0 dependency is determined when adding the package to the action.

Solution

Follow the steps or video below.

 

Configure the Action to use a supported Node Module.

In actions, add the dependency following the steps described below:
 

1. Click on the Dependencies icon on the left side of the edit screen.   
Dependencies button

2. Click the Add Dependency button.
Captura de pantalla 2024-09-17 a la(s) 3.06.59 p. m..png

3. Enter the name and version of the dependency, for example:
Dependency Name and Version

The version may be left blank to add the latest supported version of the dependency.

 

Recommended content

No recommended content found...