I'm using mongodb in node.js with Gridfs and I encounter TypeError: Promise is not a constructor
on this line. I've traced this back a little bit, and I can see that on this line, topology.s.promiseLibrary
is undefined. I don't know what I could have done to cause this. It was my understanding that mongodb would just use the built-in ES6 Promise even if I don't hook up bluebird or something like that.
Curiously, topology.s.options.promiseLibrary
is defined. I'm not sure if there's something I've done wrong to configure it. I haven't changed my code (I've reverted back to code that was working before). My node version is v9.2.0. My Mongodb is 3.10.0. My gridfs-stream is 1.1.1.
If I comment out this line then everything works fine.
const Promise = topology.s.promiseLibrary;
Is this a bug? What might be the cause? It seems like there might be an external cause, but I'm not sure where to continue my search. How is topology.s.promiseLibrary
supposed to be getting set? Why isn't it defined?