Custom Action: Cannot make an API call via fetch (using Node18)

Here is what my flow is supposed to do
1.) Upon Google Login, make an API call to my application. This will return true of false
2.) If false is returned, deny access

I keep getting the following error
cause: IdentityProviderError: access_denied (Compilation failed: Cannot find module 'node-fetch'
Require stack:

  • /data/io/node18-actions/05566f46-b5d8-48b8-974a-8599033c049d/webtask.js)
    at IdentityProviderError.EscapedError [as constructor] (/Users/pratyakshsharma/VSCodeProjects/swm-frontend/node_modules/@auth0/nextjs-auth0/dist/auth0-session/utils/errors.js:14:16)
    at new IdentityProviderError (/Users/pratyakshsharma/VSCodeProjects/swm-frontend/node_modules/@auth0/nextjs-auth0/dist/auth0-session/utils/errors.js:72:16)
    at /Users/pratyakshsharma/VSCodeProjects/swm-frontend/node_modules/@auth0/nextjs-auth0/dist/auth0-session/handlers/callback.js:60:33
    at step (/Users/pratyakshsharma/VSCodeProjects/swm-frontend/node_modules/tslib/tslib.js:195:27)
    at Object.throw (/Users/pratyakshsharma/VSCodeProjects/swm-frontend/node_modules/tslib/tslib.js:176:57)
    at rejected (/Users/pratyakshsharma/VSCodeProjects/swm-frontend/node_modules/tslib/tslib.js:167:69)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    error: ‘access_denied’,
    errorDescription: ‘Compilation failed: Cannot find module 'node-fetch'\n’ +
    ‘Require stack:\n’ +
    ‘- /data/io/node18-actions/05566f46-b5d8-48b8-974a-8599033c049d/webtask.js’,
    expose: true,
    statusCode: 400,
    status: 400,
    openIdState: { returnTo: ‘http://localhost:3000’ }

Can someone please help ? Here is how I make the Call

const response = await fetch(apiEndpoint, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’
body: JSON.stringify({ email: userEmail })
I even used const fetch = require(‘node-fetch’); But that does not help either

Hi @pratsandboxwealth,

Welcome to the Auth0 Community!

When using Node 18 in Actions, you must add the modules as a dependency.

See below:

For a list of all the available modules, please check out Can I require? - Search which node modules you can use in


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