You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
mongoose.connection is undefined after 'connect' after library updates
#13653
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
7.3.4
Node.js version
19.7.0
MongoDB server version
Atlas
Typescript version (if applicable)
5.1.6
Description
I did some experiments on a test branch that involved installing / upgrading several packages. None were related to mongoose, but I noticed that my app's initial connection attempt is failing with this error now:
TypeError:` Cannot read properties of undefined (reading 'on')
Which basically means that
mongoose.connection
is undefined even though I'm awaiting the
connect
method.
My connection routine has an automatic retry, and it fails reliably on the initial attempt, and succeeds reliably on the second. It's not a problem for me as it's only a test branch with all the test packages, but I though I'd give you a heads-up.
Further observations:
We were on mongoose ^6.6.5 and then upgraded to the latest, which didn't change anything
I can send you guys the yarn.lock files to get a delta if you want (preferrable wouldn't want to paste that here though))
Feel free to close this at any time. As said, it's more of an FYI than an actual problem for us currently
Steps to Reproduce
I'm just awaiting mongoose.connect(...)
Expected Behavior
mongoose.connection to not be undefined after connecting.
Activity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment