Forestadmin cannot generate project for mongodb database

Hello,

I am trying to use forestadmin in order to connect to our AWS doc db database (mongodb), i followed all the steps but the connection is not working.

when i type the following command in order to generate the project:

docker run
-v pwd:/usr/src/app --init
-e DATABASE_SSL=“true”
-e DATABASE_URL=“mongodb://xxxx:xxxxx@host.docker.internal:27017/brandConnector?ssl=true&ssl_ca_certs=./rds-combined-ca-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false”
-e APP_NAME=“brandconnector-bo”
-e FOREST_EMAIL=“xxxxxx”
-e FOREST_TOKEN=“xxxxxxx”
-e APPLICATION_HOST=“localhost”
-e APPLICATION_PORT=“3310”
-ti forestadmin/lumber

I have the following error:

✓ Connecting to your database
:heavy_multiplication_x: Analyzing the database

Cannot generate your project.
An unexpected error occurred. Please reach out for help in our Developers community (https://community.forestadmin.com/) or create a Github issue with following error: MongoError: Unsupported BSON : type JavaScript
(node:15) UnhandledPromiseRejectionWarning: MongoError: Unsupported BSON : type JavaScript
at Connection. (/usr/local/lib/node_modules/lumber-cli/node_modules/mongodb/lib/core/connection/pool.js:466:61)
at Connection.emit (events.js:198:13)
at processMessage (/usr/local/lib/node_modules/lumber-cli/node_modules/mongodb/lib/core/connection/connection.js:364:10)
at TLSSocket. (/usr/local/lib/node_modules/lumber-cli/node_modules/mongodb/lib/core/connection/connection.js:533:15)
at TLSSocket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at TLSSocket.Readable.push (_stream_readable.js:224:10)
at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
(node:15) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can you please helps on that topic.

Thanks for your support.

Regards,
Sarah

Hi @shadbi, and welcome to our community !

I’m not sure of the support of BSON Javascript type using lumber. I’ll do a quick test on my end and update this post with a more complete answer once I’ve got everything setup

Hi Jeff,

Thanks for your replay, to give you more details our mongodb database is an AWS DocumentDB database. and it’s contains an ssl certificate to connect.

So I am setting in the command:

DATABASE_URL=“mongodb://xxxx:xxxxx@host.docker.internal:27017/brandConnector?ssl=true&ssl_ca_certs=./rds-combined-ca-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false”

otherwise it will not be able to connect and it’s end with timeout connection.

Is it the rights arguments to use, when we want to connect ForestAdmin to an SSL mongo database ?

I want to be sure, that the error above are not coming from wrong properties on my connection command.

Thanks for you replay.

The environment variable you have seems good to me - and the stack trace of your first message seems to indicate an issue during the database introspection.

Do you know if any specific data in your database that have such a type? Could you (If that’s possible on you end of course) share a dump or an example of data that would lead to this type issue?

I’m currently digging in the lumber generate code to see if I can locate any incompatibilities with BSON Javascript, since I’m not sure that this is something we currently support.

I asked our architect and he said to me that we are not using specific data type, it’s just documents on json but that’s it.

our mongoDB is an AWS documentDB database, maybe there is no support in case of AWS documentDB ?

I did a quick local test to check if I was able to reproduce this issue with a local mongodb database, and I’m not able to.
I’ll try using directly an AWS DocumentDB just in case the introspection issue comes from there, and I’ll keep you updated.

Just to be sure, the command you provided on the first post mention host.docker.internal as your database URL - are you using SSH tunneling or port forwarding to connect to your DocumentDB instance ?

yes i am using an ssh tunnel, and i tested the connection with mongodb shell from my localhost and it’s working.

so the issue don’t seems to come from connection.

Yes if you can try with a documentDB database to see if the issue is coming from that.

Thank you

Hi @shadbi,

Sorry for the delayed response.

I’m totally able to reproduce this issue without any specific configuration using AWS DocumentDB and a SSH tunnel, so it seems, indeed, an issue related to the lumber/documentDB link.

I’m pushing this to our product board, for a complete DocumentDB support. In the meantime, I would suggest to dump this database and run it locally if that’s possible.

1 Like

Hi @jeffladiray,

Thanks for your replay, unfortunately in our case we want to use ForestAdmin to connect to our DocumentDB backend. so we will try another solution.

Please let me know when a fix will be done on your side.

Thank you for your support.

Hi,

We have the same problem :frowning: We’re using AWS DocumentDB. As mentioned here, the problem causes because of type support of DocumentDB. I wonder if there is an estimated date for DocumentDB (AWS’s MongoDB) compatibility?

Thanks.

Hello @mrpeker and welcome to the Forest Admin community,

I’m sorry but DocumentDB integration does not have an estimated date for release yet.

I’ll forward your message to the product team to emphasise the need for it.

2 Likes

Hi @mrpeker @shadbi

The team did some further tests on DocumentDB in order to find an “easy” solution to this issue.
We can’t still provide an ETA on the full onboarding using DocumentDB, but some interesting discoveries were made.

If you are able to pass the model generation (Eg. Using lumber generate on a locally running dump of the DocumentDB cluster), you should be able to then switch to the cluster URL in DATABASE_URL of your .env file (This will still require the SSH tunnel to be running).
The issue with DocumentDB is located on our model introspection algorithm, and does not seems to cause any issue once this step is done.

This is not a perfect solution, but should at least allow you to run your lumber project using DocumentDB.

Let me know if that helped.