# Cannot require necessary package on Node 22 tenant - google-auth-library

**URL:** <https://community.auth0.com/t/cannot-require-necessary-package-on-node-22-tenant-google-auth-library/202517>\
**Category:** Get Help\
**Tags:** extensions\
**Created:** [August 12, 2026, 7:42pm UTC](https://community.auth0.com/t/cannot-require-necessary-package-on-node-22-tenant-google-auth-library/202517 "2026-08-12T19:42:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![architect](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/architect/32/65633_2.png) [@architect](https://community.auth0.com/u/architect)\
**Post date:** [August 12, 2026, 7:42pm UTC](https://community.auth0.com/t/cannot-require-necessary-package-on-node-22-tenant-google-auth-library/202517/1 "2026-08-12T19:42:28Z")

</div>

As requested by the warning I got that the NodeJS 18 runtime I had been depending on was going to be deprecated, I upgraded my tenant to Node 22.

The one consequence of this is that the Hooks that are written for the Delegated Admin Extensions (write hook and query hook), the packages available via “require(‘package-name@version’)” are limited to the ones available at [Can I require? - Search which node modules you can use in webtask.io](https://auth0-extensions.github.io/canirequire/) when selecting the Node 22 runtime.

There is one library ‘google-auth-library’ that is a dependency of a supported library “googleapis” however depending directly on the “google-auth-library” in a hook causes an error once swapped to the Node 22 runtime as the ‘google-auth-library’ is available in Node 18 but strangely even thought its dependent is there, not available in Node 22.

I would love to file a github issue in the ‘auth0-extensions/canirequire’ project but all issue creation has been disabled.

I have requirements to use the Google Auth Library with no alternatives I can find to do what I need. Can we get the Node 22 runtime updated to have the ‘google-auth-library’ available somehow?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [August 13, 2026, 3:00pm UTC](https://community.auth0.com/t/cannot-require-necessary-package-on-node-22-tenant-google-auth-library/202517/3 "2026-08-13T15:00:38Z")

</div>

Hi @architect

Welcome to the Auth0 Community!

It appears 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.

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.

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:

```auto
///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)**.

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:

1. In your Dashboard, go to **Actions \> Library**

2. Click **Create Action** and select **Node 22** as the runtime

3. Click the **Dependency (cube)** icon on the left sidebar

4. Click **Add Module** , search for `google-auth-library`, and save it

5. 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](https://dev.auth0.com/docs/troubleshoot/product-lifecycle/deprecations-and-migrations/migrate-nodejs-22)

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 15, 2026, 3:01pm UTC](https://community.auth0.com/t/cannot-require-necessary-package-on-node-22-tenant-google-auth-library/202517/4 "2026-08-15T15:01:21Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
