Request to Webtask exceeded allowed execution time

I’m getting the “Request to Webtask exceeded allowed execution time” error when trying to use a custom database with mongodb.

I’ve downloaded the Real Time Webtask Logs extension and I keep getting a UnhandledPromiseRejectionWarning with the message TypeError [ERR_INVALID_ARG_TYPE]: The “url” argument must be of type string. Received undefined.

I think it’s because I’ve been trying to use the configuration variables for database settings; I currently have a key DB_URL set to my database’s URL. I have tried putting the URL in quotations and not in quotations and both times I get the same error. Everything else I have been using the default mongodb template that auth0 has provided.

EDIT: Forgot to mention, but I had to delete the @3.1.4 from require(‘mongodb’).

Ok, now it seems like the issue is with the connection string. I think auth0 might be using an older version of MongoClient that only accepts connection strings that start ONLY with mongodb://. However, this isn’t possible for me as I need the mongodb+srv:// starter. Any help would be appreciated.

It’s likely the default version used when you do require('mongodb') is old and doesn’t support the scheme. It should work with 3.1.4 though - any particular reason you deleted the @3.1.4 part?

The available NPM module versions in custom DB scripts can be found here: https://auth0-extensions.github.io/canirequire/#mongodb
I would encourage pinning the version with an @ since the default version can change in the future causing the script to potentially break.

1 Like

When using the 3.1.4 part, I would get the error “The server is being accessed through a load balancer, but this driver does not have load balancing enabled”

1 Like

Using mongodb@4.1.0 fixes things.

1 Like