# Module issue in Auth0 actions

**URL:** <https://community.auth0.com/t/module-issue-in-auth0-actions/108937>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [June 9, 2023, 7:03am UTC](https://community.auth0.com/t/module-issue-in-auth0-actions/108937 "2023-06-09T07:03:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmdanish](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mmdanish/32/47292_2.png) [@mmdanish](https://community.auth0.com/u/mmdanish)\
**Post date:** [June 9, 2023, 7:03am UTC](https://community.auth0.com/t/module-issue-in-auth0-actions/108937/1 "2023-06-09T07:03:52Z")

</div>

i want to create a **custom action** for assigning the user\_id to the logged in user based on userID in database but when i testing the custom action it is giving the error as:  
action logic **code** is as :

```auto
const ADODB = require("node-adodb");

module.exports = async function onExecutePostLogin(event, api) {
  const { email } = event.user; // Assuming you retrieve the email from the authenticated user object

  // Building connection with MS Access file using ADODB package
  const connection = ADODB.open(
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db/att2000.mdb;"
  );

  // Query for accessing the database
  const queryResult = () => {
    return `
      SELECT USERID, Email
      FROM USERINFO
      WHERE Email='${email}'
    `;
  };

  try {
    // Retrieve data from the Access database based on the email
    const result = await connection.query(queryResult());

    if (result.length > 0) {
      // Assign the user ID from the database to the logged-in user's user_metadata
      const userId = result[0].USERID;

      // Perform any desired action with the obtained userId, such as updating user metadata in Auth0
      // For example, using Auth0 Management API:
      const auth0 = require('auth0@2.35.0');
      const management = new auth0.ManagementClient({
        domain: 'https://pixako.us.auth0.com',
        clientId: 't21ePuSIQgHLCKbInTN5SQvu38nwg6TJ',
        clientSecret: 'UcRBgMhL9FqI3zvMMdzFcM9QXxMb80MiRg7W05yLR_9UPV--4KLviZzpNhhQM2Xd',
        scope: 'update:users',
      });

      await management.updateUser({ id: event.user.sub }, { user_metadata: { id: userId } });
    }

    // Return the updated event object
    return {
      user: event.user,
      context: event.context,
      stats: {
        loginsCount: event.stats.loginsCount + 1,
      },
    };
  } catch (error) {
    // Handle any errors that occur during the database operation
    console.error(error);
    throw new Error('An error occurred while executing the post-login action.');
  } finally {
    // Close the database connection
    connection.close();
  }
};

```

```auto
Error:
{
  "code": 400,
  "details": "",
  "error": "Cannot find module 'node-adodb'\nRequire stack:\n- /data/io/node16/58e77637-ae5b-4ae5-b1d5-7955db88cd1d/webtask.js",
  "message": "Compilation failed: Cannot find module 'node-adodb'\nRequire stack:\n- /data/io/node16/58e77637-ae5b-4ae5-b1d5-7955db88cd1d/webtask.js",
  "name": ""
}

```

when add the dependency on test as :  
node-adodb@latest

it gives error as :  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/a/2ac3efa900d42636eb985d767c5959c728c3ac22.png)

---

<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 19, 2023, 11:15pm UTC](https://community.auth0.com/t/module-issue-in-auth0-actions/108937/3 "2023-09-19T23:15:44Z")

</div>

Hi @mmdanish,

Unfortunately, the node-adodb module is not one of the available modules that you can use.

For the full list of available modules, please see: [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:** [October 3, 2023, 11:16pm UTC](https://community.auth0.com/t/module-issue-in-auth0-actions/108937/4 "2023-10-03T23:16:00Z")

</div>

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