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

**URL:** <https://community.auth0.com/t/custom-action-cannot-make-an-api-call-via-fetch-using-node18/115130>\
**Category:** Get Help\
**Tags:** login-prompt-new-experience, login-experience\
**Created:** [August 31, 2023, 4:03pm UTC](https://community.auth0.com/t/custom-action-cannot-make-an-api-call-via-fetch-using-node18/115130 "2023-08-31T16:03:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pratsandboxwealth](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pratsandboxwealth/32/50431_2.png) [@pratsandboxwealth](https://community.auth0.com/u/pratsandboxwealth)\
**Post date:** [August 31, 2023, 4:03pm UTC](https://community.auth0.com/t/custom-action-cannot-make-an-api-call-via-fetch-using-node18/115130/1 "2023-08-31T16:03:32Z")

</div>

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  
{  
code: ‘ERR\_CALLBACK\_HANDLER\_FAILURE’,  
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](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

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 1, 2023, 7:03pm UTC](https://community.auth0.com/t/custom-action-cannot-make-an-api-call-via-fetch-using-node18/115130/3 "2023-09-01T19:03:27Z")

</div>

Hi @pratsandboxwealth,

Welcome to the Auth0 Community!

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

See below:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/a/5a322e7ac0f320b554dff9c839c1d1c702ee35b0.png)

For a list of all the available modules, please check out [Can I require? - Search which node modules you can use in webtask.io](https://auth0-extensions.github.io/canirequire//)

Thanks,  
Rueben

---

<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:** [September 15, 2023, 7:03pm UTC](https://community.auth0.com/t/custom-action-cannot-make-an-api-call-via-fetch-using-node18/115130/4 "2023-09-15T19:03:38Z")

</div>

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