Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump winston-transport from 4.7.1 to 4.8.0 #121

Closed

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Sep 30, 2024

Bumps winston-transport from 4.7.1 to 4.8.0.

Release notes

Sourced from winston-transport's releases.

v4.8.0

  • Bump readable-stream from 3.6.0 to 4.5.2 (#201) 000b11f
  • Bump nyc from 17.0.0 to 17.1.0 (#243) 7e7dbc6
  • Bump mocha from 10.6.0 to 10.7.3 (#233) d85058c
  • Bump @​types/node from 20.14.10 to 22.6.0 (#241) f721b63
  • Bump eslint from 9.6.0 to 9.11.0 (#242) ff4f65e
  • fix tests (#244) fb8383e

winstonjs/winston-transport@v4.7.1...v4.8.0

Commits

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot requested a review from a team as a code owner September 30, 2024 18:29
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Sep 30, 2024
Copy link

qodo-merge-pro bot commented Sep 30, 2024

CI Failure Feedback 🧐

(Checks updated until commit 46c7734)

Action: build (18.x)

Failed stage: Run npm test [❌]

Failed test name: winston-logstash-udp transport with logstash server handles bad formatted logs

Failure summary:

The action failed due to two failing tests in the winston-logstash-udp transport suite with the
logstash server:

  • The first test, handles bad formatted logs, failed with a TypeError because of a circular structure
    being converted to JSON.
  • The second test, also named handles bad formatted logs, failed because the done() callback was
    called multiple times, and it was expected that a function would throw an error, but it did not.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    176:  with logstash server
    177:  ✔ handles non-objects in splat
    178:  ✔ send logs over UDP as valid json
    179:  1) handles bad formatted logs
    180:  2) handles bad formatted logs
    181:  ✔ send logs with splat over UDP as valid json
    182:  ✔ adds an operating system's EOL character
    183:  without logstash server
    184:  ✔ return an error message if UDP DNS errors occur on the socket
    185:  5 passing (42ms)
    186:  2 failing
    187:  1) winston-logstash-udp transport
    188:  with logstash server
    189:  handles bad formatted logs:
    190:  Uncaught TypeError: Converting circular structure to JSON
    ...
    
    215:  at /home/runner/work/winston-logstash-udp/winston-logstash-udp/test/winston-logstash-udp_test.js:131:16
    216:  at Proxy.assertThrows (node_modules/chai/lib/chai/core/assertions.js:2644:7)
    217:  at Proxy.methodWrapper (node_modules/chai/lib/chai/utils/addMethod.js:57:25)
    218:  at Context.<anonymous> (test/winston-logstash-udp_test.js:132:18)
    219:  at process.processImmediate (node:internal/timers:476:21)
    220:  2) winston-logstash-udp transport
    221:  with logstash server
    222:  handles bad formatted logs:
    223:  done() called multiple times in test <winston-logstash-udp transport with logstash server handles bad formatted logs> of file /home/runner/work/winston-logstash-udp/winston-logstash-udp/test/winston-logstash-udp_test.js; in addition, done() received error: AssertionError: expected [Function] to throw an error
    ...
    
    238:  at next (/home/runner/work/winston-logstash-udp/winston-logstash-udp/node_modules/mocha/lib/runner.js:509:10)
    239:  at Immediate.<anonymous> (/home/runner/work/winston-logstash-udp/winston-logstash-udp/node_modules/mocha/lib/runner.js:570:5)
    240:  at process.processImmediate (node:internal/timers:476:21) {
    241:  showDiff: true,
    242:  actual: undefined,
    243:  expected: null,
    244:  operator: 'strictEqual'
    245:  }
    246:  Error: done() called multiple times in test <winston-logstash-udp transport with logstash server handles bad formatted logs> of file /home/runner/work/winston-logstash-udp/winston-logstash-udp/test/winston-logstash-udp_test.js; in addition, done() received error: AssertionError: expected [Function] to throw an error
    ...
    
    249:  at Context.<anonymous> (test/winston-logstash-udp_test.js:132:18)
    250:  at process.processImmediate (node:internal/timers:476:21) {
    251:  showDiff: true,
    252:  actual: undefined,
    253:  expected: null,
    254:  operator: 'strictEqual'
    255:  }
    256:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    257:  ##[error]Process completed with exit code 2.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Bumps [winston-transport](https://github.com/winstonjs/winston-transport) from 4.7.1 to 4.8.0.
    - [Release notes](https://github.com/winstonjs/winston-transport/releases)
    - [Changelog](https://github.com/winstonjs/winston-transport/blob/master/CHANGELOG.md)
    - [Commits](winstonjs/winston-transport@v4.7.1...v4.8.0)
    
    ---
    updated-dependencies:
    - dependency-name: winston-transport
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    @dependabot dependabot bot force-pushed the dependabot-npm_and_yarn-winston-transport-4.8.0 branch from f33e026 to 46c7734 Compare October 8, 2024 00:11
    @shamil
    Copy link
    Member

    shamil commented Oct 23, 2024

    @ramhr can you please take a look

    @shamil shamil assigned ramhr and unassigned yosiat Oct 23, 2024
    const logMessage = this._buildLog(info);

    this.sender.send(logMessage, (err) => {
    this.sender.send(info[MESSAGE], (err) => {
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    The info[MESSAGE] is the formatted message as built in the format phase of the winston-transport pipeline. The info itself is still the same log object.

    @@ -185,7 +190,7 @@ class LogstashUDP extends Transport {
    }

    _buildLog(info) {
    const meta = Object.assign({}, info, this.meta_defaults);
    const meta = Object.assign(info, this.meta_defaults);
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    winston-transport already does Object.assign({}, info) before passing it to the format, so it's already a fresh object and no need to dup it again.

    if (!this.format) {
    this.format = defaultFormat;
    } else {
    this.format = winston.format.combine(this.format, defaultFormat);
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Just in case someone passes a custom format in the options, merge it with the udp transport format.


    expect(() => {
    logger.info("bad", { timer: setTimeout(() => {}, 10) });
    logger.info("bad", { circular });
    Copy link

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This gives the same affect, but is clearer to understand.

    @ramhr
    Copy link

    ramhr commented Oct 27, 2024

    @shamil @yosiat please check out my fix commit and it's message and review: 039107e

    With the updated `winston-transport`, the transport write pipeline was changed, the place where the `log` method is called is different. Before, errors inside the log were always handled synchronously right after the write, but now in practice it's handled in `process.nextTick`.
    
    This still runs in the same tick of the event loop, but after the current operation is finished. As a side effect, this means that errors thrown there are not caught in the current operation's context and try/catch blocks wrapping it won't work.
    
    This means that in case of the format error which is tested in the broken unit test, no error is caught in the test so it fails. In fact, the logger does throw the error, but it's thrown only after the test finishes as an unhandled exception, which is very bas and I guess that's why this test exists.
    
    In order to fix the issue, I moved the message formatting into the `format` part of the winston-transport pipeline, instead of inside of the `log` function itself. When there is a formatting error inside this pipeline, winston catches it on it's own, handles it internally and rethrows it, so the log action would throw it and it can be caught.
    @ramhr ramhr force-pushed the dependabot-npm_and_yarn-winston-transport-4.8.0 branch from 8ae3e50 to 039107e Compare October 27, 2024 16:03
    Copy link
    Contributor Author

    dependabot bot commented on behalf of github Nov 11, 2024

    A newer version of winston-transport exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged.

    @ramhr
    Copy link

    ramhr commented Jan 5, 2025

    @dependabot recreate

    Copy link
    Contributor Author

    dependabot bot commented on behalf of github Jan 5, 2025

    Superseded by #131.

    @dependabot dependabot bot closed this Jan 5, 2025
    @dependabot dependabot bot deleted the dependabot-npm_and_yarn-winston-transport-4.8.0 branch January 5, 2025 08:29
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    dependencies Pull requests that update a dependency file
    Development

    Successfully merging this pull request may close these issues.

    3 participants