sidorares / sidorares/node-mysql2

stream: function() support doesn't work as documented.

Open
#980 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

The docs say that the function is async and should call a callback upon creation of the stream.

  stream: function (cb) {
    const newStream = new SocksConnection({host: 'remote.host', port: 3306}, {host: 'localhost', port: 1080});
    cb(null, newStream);
  }

The code says the function is synchronous and should return the stream.

      // if stream is a function, treat it as "stream agent / factory"
      if (typeof opts.config.stream == 'function') {
        this.stream = opts.config.stream(opts);
      } else {

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the documented stream option with the implementation around the shown opts.config.stream branch. Determine whether the stream factory should use a callback or return a stream, then align the implementation and documentation so the stated contract is consistent and verifiable.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.