require modules that Auth0 provides, which you check with Can I require: Auth0 Extensibility. Older runtimes also expose some modules as magic globals.
npm public registry
Actions and Hooks let you add a module and version as a dependency, and Auth0 installs it from the npm public registry. You don’t need Can I require.- Add the module and version as a dependency of the Action or Hook, then
requireit in your code. - Modules must be public. Modules from private repositories aren’t supported.
- Modules that rely on native add-ons can’t be installed.
- Make sure the version you pick supports the Node.js runtime you selected.
Can I require
Rules, Custom Database scripts, and Custom Social Connection scripts can’t install modules. They can onlyrequire the modules and versions that Auth0 provides in the sandbox, and that list differs for each runtime. To check a module, find alternatives, and see the versions Node 18 removed, read Can I Require.
Magic globals
On Node 12, Rules and Custom Database scripts expose some npm modules as globals, such as_, async, jwt, and request, so you can use them without calling require. These are called magic modules or magic globals.
To see the full list of globals and how to replace them, read Magic Globals.
When you change runtimes
Module availability can change between runtimes, and some modules or versions are removed.- For Actions and Hooks, confirm that each dependency supports the target runtime.
- For Rules, Custom Database scripts, and Custom Social Connection scripts, check every
required module against the target runtime in Can I require, and replace any magic globals.