Unable to do API call during login flow due to failure while requesting the Axios module in Actions with Node 18

Problem statement

We are doing an API call to update our DB as part of our login flow. We are using Axios for that. Currently, it stopped working, and we are getting an error in the logs:

"onExecutePostLogin - authorization event Operate
user registration webhook exception Error: Cannot find module 'axios'
Require stack:
- /data/io/node18-actions/7b9cf099-01a4-4079-8a81-bf8ea42edaaa/webtask.js
at Module._resolveFilename (node:internal/mo"


In Node 18 and any new future versions, we deprecated the usage of built-in libraries, so you need to explicitly set the library and its’ version on the actions dependency view, and then you may call the library within theAaction without specifying the version number.

This is briefly mentioned on the following link, in the " Magic NPM Modules" section:

Here is a sample usage for the Axios library. The usage style applies to any dependencies required in your Action.

1 Like