Connecting Auth0 to MongoDB

I also got the same issue

1 Like

hi @taitheexplore @kristina71103, I’ve routed this internally as I don’t have an immediate answer, but I’ll get back to you soon.

Thanks

1 Like

I also got same error, cannot find any solution for this, what we can do? Below mentioned fully detailed error stack from Webtask Logs.

Hello everyone, facing the exact same issue here:

[SandboxUnhandledError] Cannot find module ‘mongodb@3.1.4’
Require stack: - /data/io/node18/5777205b-486a-478a-a40a-e11cbb127480/webtask.js

I tried the alternatives mentioned above but none of them work for my case as well. Is there any updates ?

1 Like

Hi @marialena @buddhins @taitheexplore,

The issue seems related to the version of NodeJS you are running in your tenant (you can check your version here: https://manage.auth0.com/#/tenant/advanced).

The following versions of mongodb drivers are available for the following NodeJS versions:

  • NodeJS 18
    • 5.1.0
    • 5.7.0
  • NodeJS 16
    • 3.5.11
    • 3.1.4
    • 2.1.11

If you want to check other packages or other versions of node, please check out the following page:

https://auth0-extensions.github.io/canirequire/

By adjusting the right mongo driver to match your tenant’s NodeJS version your issue gets fixed.

Thanks

1 Like

Thank you @bajcmartinez . Error fixed. In my tenant, it used Node 18, then I changed it to NodeJS 16 and import mongodb version 4.1.0 version (const MongoClient = require(‘mongodb@4.1.0’).MongoClient;). Now it works without any error.

That’s great @buddhins, thanks for replying back with the confirmation. I’ll make changes on the article so that this topic is address.

Have a great day!