Hey, all. Sorry if this has been asked/answered before, but I had no luck finding anything on the topic. I’m new to both the community, and MongoDB!
I am developing and API using node.js and MongoDB. Locally, I am able to make successful calls to my API through Postman.
However, when making the same exact calls on my deployed site (Azure hosted), I get the exception:
"MongoServerError: Expected type string but found null.\n
at Connection.onMessage (/home/site/wwwroot/node_modules/mongodb/lib/cmap/connection.js:205:26 undefined)\n
at MessageStream.<anonymous> (/home/site/wwwroot/node_modules/mongodb/lib/cmap/connection.js:64:60 undefined)\n
at MessageStream.emit (node:events:514:28 undefined)\n
at processIncomingData .processIncomingData (/home/site/wwwroot/node_modules/mongodb/lib/cmap/message_stream.js:117:16 undefined)\n
at MessageStream._write (/home/site/wwwroot/node_modules/mongodb/lib/cmap/message_stream.js:33:9 undefined)\n
at writeOrBuffer .writeOrBuffer (node:internal/streams/writable:447:12 undefined)\n
at _write ._write (node:internal/streams/writable:389:10 undefined)\n
at Writable.write (node:internal/streams/writable:393:10 undefined)\n
at TLSSocket.ondata (node:internal/streams/readable:817:22 undefined)\n
at TLSSocket.emit (node:events:514:28 undefined)"
The exception is thrown upon calling collection.insertOne(document)
I’m at a loss as to what is causing this issue. The document that I am sending to the insertOne function is well defined and contains valid values. I’ve not got any sort of schema definitions either. I’ve tried just about all I know to try.
Has anyone else experienced this problem?