Hi @architect
Welcome to the Auth0 Community!
I understand that you have hit a very specific, known discrepancy in the module dependency tree for the legacy Webtask/Rules/Hooks platform’s transition to the Node 22 runtime. Even though googleapis is supported and internally depends on google-auth-library, declaring a direct dependency on google-auth-library in Node 22 throws a “Cannot find module” error because it has not been explicitly whitelisted for direct require() statements on the Node 22 runtime whitelist.
Root cause
Unlike Auth0 Actions, legacy Rules, Hooks, and Custom Database Scripts run on a shared, pre-compiled sandbox managed by the underlying Webtask engine.
Because the packages available to require() in these legacy extensibility points are pre-cached, the canirequire repository defines a locked list of permissible modules. In the transition from Node 18 to Node 22, the package googleapis was updated, but its peer dependency, google-auth-library, was inadvertently omitted from the top-level whitelist of the Node 22 compiler profile, despite being bundled inside googleapis.
Since the auth0-extensions/canirequire repository has disabled public issue creation, you cannot flag this via a GitHub PR or issue directly.
Official Recommendations
Depending on your architecture, there are two distinct ways to bypass this roadblock:
Option 1:
Since googleapis is natively whitelisted on the Node 22 profile, the actual google-auth-library code is already present in the sandbox node_modules directory—it is just not accessible under its own direct name.
You can resolve your imports by bypassing the top-level namespace and pulling the auth client straight out of the parent googleapis package, which acts as a wrapper:
///Instead of:
//const { GoogleAuth } = require('google-auth-library');
//Use the parent "googleapis" package to access the same authentication class:
const { google } = require('googleapis');
// Extract the GoogleAuth class directly from the googleapis package:
const GoogleAuth = google.auth.GoogleAuth;
// Initialize it exactly as you did before:
const auth = new GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform']
});
Option 2:
Because Auth0 is fully deprecating Rules and Hooks, they are scheduled to reach End-of-Life (EOL). However, the deprecation does not affect the Hooks that the Delegated Administration Extension (DAE) version 3 utilizes. The Delegated Administration Extension Hooks function independently from the core Auth0 Hooks reaching end of life. Administrators do not need to migrate or update the Delegated Administration Extension Hooks in response to the deprecation of the core Auth0 Hooks.
However, if your Delegated Admin Extension hook can be refactored, migrating it to a Post-Login Action is the highly recommended long-term path. In Auth0 Actions, you are no longer limited by the canirequire list and can explicitly declare google-auth-library as an independent dependency in the Modules pane:
-
In your Dashboard, go to Actions > Library
-
Click Create Action and select Node 22 as the runtime
-
Click the Dependency (cube) icon on the left sidebar
-
Click Add Module, search for google-auth-library, and save it
-
You can now use the library natively with standard require('google-auth-library') statements
These steps are provided by our guide on Migrating From Node18 to Node22
If you must stick to the legacy Hook framework for the Delegated Admin Extension, Option 1 will safely unblock your Node 22 upgrade immediately.
Kind Regards,
Nik