Automattic / Automattic/monk

Event 'error-opening' emitted before listener attached

Open
#250 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.8k
Forks
180
PR merge metrics
No merged PRs in 30d

Description

Hi there,

I was setting this up as per the 'Connecting to MongoDB' section of the 'Getting Started' instructions in the documentation, and found that a poorly formed url would cause the system to exit instead of generating the expected promise rejection. From the code it looks like the url is tested in the monk constructor and an 'error-opening' event is emitted before an event listener is attached in the 'then' function.

This all means that the error is not caught and goes unreported, and the program fizzles out without any indication of the error that has just occurred, in my case it was 'Error: slash in host identifier'.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Connecting to MongoDB section of the Getting Started documentation and reproduce the behavior with a poorly formed URL. Inspect the monk constructor and the then function, where the issue reports that the URL error is emitted before the listener is attached; done means the malformed URL produces the expected promise rejection instead of an unreported process exit.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.