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

cls versioned tests fail on npm 7 when running with continuation-local-storage@2.6.2 #756

Closed
bizob2828 opened this issue May 13, 2021 · 1 comment · Fixed by #772
Closed

Comments

@bizob2828
Copy link
Member

bizob2828 commented May 13, 2021

Description

While triaging failures in this PR newrelic/newrelic-node-apollo-server-plugin#75, it was discovered that some versioned tests in the agent were failing. A few fixes were made(#751, newrelic/node-test-utilities#75) but an issue with continuation-local-storage still exists. It appears npm 7 no longer will install dependencies that cannot be fulfilled by engines stanzas.

Expected Behavior

This is a little tricky. The expected behavior is that async-listener(optional dep of continuation-local-storage) is installed. However the version 0.4.5 has an engines stanza as

"engines": {
    "node": "<=0.11.8"
  },

The reason this is tricky because it appears that pre npm 7 would install this dependency even though the engines range is invalid.

npm 7 output

❯ npm i  continuation-local-storage@2.6.2

added 3 packages, and audited 4 packages in 755ms

found 0 vulnerabilities

npm 6 output

npm i  continuation-local-storage@2.6.2
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN notsup Unsupported engine for async-listener@0.4.5: wanted: {"node":"<=0.11.8"} (current: {"node":"14.16.1","npm":"6.14.13"})
npm WARN notsup Not compatible with your version of node/npm: async-listener@0.4.5

+ continuation-local-storage@2.6.2
added 4 packages from 2 contributors and audited 4 packages in 0.998s
found 0 vulnerabilities

Notice 3 packages on npm 7 vs 4 on npm 6

Steps to Reproduce

Assumption: npm 7 is installed

  • npm i continuation-local-storage@2.6.2

Your Environment

  • npm 7

Additional Context

The cls versioned tests will fail with the following error

added 2 packages, and changed 1 package in 703ms
TAP version 13
# Subtest: transaction state
    1..1
    # Subtest: should be preserved over timers regardless of order required
        not ok 1 - Cannot find module 'async-listener' Require stack: - /Users/revans/code/pull-requests/node-newrelic/test/versioned/cls/node_modules/continuation-local-storage/context.js - /Users/revans/code/pull-requests/node-newrelic/test/versioned/cls/cls.tap.js
          ---
          stack: >
            Object.<anonymous> (node_modules/continuation-local-storage/context.js:15:32)

            Module._compile (/Users/revans/code/pull-requests/node-newrelic/node_modules/source-map-support/source-map-support.js:547:25)
          at:
            line: 880
            column: 15
            file: internal/modules/cjs/loader.js
            function: Function.Module._resolveFilename
          code: MODULE_NOT_FOUND
          requireStack:
            - /Users/revans/code/pull-requests/node-newrelic/test/versioned/cls/node_modules/continuation-local-storage/context.js
            - /Users/revans/code/pull-requests/node-newrelic/test/versioned/cls/cls.tap.js
          tapCaught: testFunctionThrow
          test: should be preserved over timers regardless of order required
          ...

        1..1
        # failed 1 test
    not ok 1 - should be preserved over timers regardless of order required # time=23.015ms

    # failed 1 test
not ok 1 - transaction state # time=33.641ms

1..1
# failed 1 test
# time=50.258ms
@bizob2828 bizob2828 added this to Triage Needed: Unprioritized Features in Node.js Engineering Board via automation May 13, 2021
@michaelgoin michaelgoin moved this from Triage Needed: Unprioritized Features to To do: Features here are prioritized in Node.js Engineering Board May 17, 2021
@michaelgoin
Copy link
Member

Its interesting that this is a polyfill

// load polyfill if native support is unavailable
if (!process.addAsyncListener) require('async-listener');

Looks like that used to exist in 0.x versions that that other package is limited to but certainly doesn't seem to exist anymore.

The latest version of the async-listener seems to have updated engines field of "node": "<=0.11.8 || >0.11.10". If you run the continuation-local-storage version 3.2.1 on Node 16, everything passes fine.

As such, we can prob limit the versions running.

@rr0214 rr0214 moved this from To do: Features here are prioritized to In progress: Issues being worked on in Node.js Engineering Board Jun 3, 2021
@michaelgoin michaelgoin self-assigned this Jun 3, 2021
Node.js Engineering Board automation moved this from In progress: Issues being worked on to Done: Issues recently completed Jul 22, 2021
@michaelgoin michaelgoin added this to Done in Node v16 Support Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Node.js Engineering Board
  
Done: Issues recently completed
Development

Successfully merging a pull request may close this issue.

2 participants