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

task: Use make-fetch-happen #1500

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

chriswk
Copy link
Contributor

@chriswk chriswk commented Apr 13, 2022

So we've had a couple of issues left hanging, one is that our http client usage for addons doesn't actually return the retried response (it does retry, but keeps the original response).

This PR switches to npm/make-fetch-happen, and replaces jest-node-fetch with nock to mock the http endpoints. Personally I find the tests to be more readable now, and we can now support retries the correct way.

@chriswk chriswk linked an issue Apr 13, 2022 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Apr 13, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/unleash-team/unleash-docs/53iZXAoTi62v71H88V13g8b7YSjh
✅ Preview: https://unleash-docs-git-739-fix-fetchretry-will-al-c25be3-unleash-team.vercel.app

@@ -99,11 +96,11 @@
"js-yaml": "^4.1.0",
"knex": "1.0.4",
"log4js": "^6.0.0",
"make-fetch-happen": "^10.1.2",
Copy link

Choose a reason for hiding this comment

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

Critical OSS Vulnerability:

pkg:npm/make-fetch-happen@10.1.2

1 Critical, 0 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies

Components
    pkg:npm/minimatch@3.0.4
      CRITICAL Vulnerabilities (1)

        [sonatype-2021-4879] Unknown

        minimatch - Regular Expression Denial of Service (ReDoS)

        CVSS Score: 7.5

        CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

        CWE: CWE-1333

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

Copy link
Contributor Author

@chriswk chriswk Apr 13, 2022

Choose a reason for hiding this comment

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

@sonatype-lift ignore

Copy link

Choose a reason for hiding this comment

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

I've recorded this as ignored for this pull request. If you change your mind, just comment @sonatype-lift unignore.

@@ -5048,6 +5209,28 @@ make-error@1.x, make-error@^1.1.1:
resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==

make-fetch-happen@^10.1.2:
Copy link

Choose a reason for hiding this comment

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

Critical OSS Vulnerability:

pkg:npm/make-fetch-happen@10.1.2

1 Critical, 0 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies

Components
    pkg:npm/minimatch@3.0.4
      CRITICAL Vulnerabilities (1)

        [sonatype-2021-4879] Unknown

        minimatch - Regular Expression Denial of Service (ReDoS)

        CVSS Score: 7.5

        CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

        CWE: CWE-1333

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@github-actions
Copy link

github-actions bot commented Apr 13, 2022

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 91.2% 5171/5670
🟡 Branches 79.31% 805/1015
🟢 Functions 86.18% 1216/1411
🟢 Lines 91.12% 5050/5542
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢 lib/addons/addon.ts
88.24% (+1.87% 🔼)
66.67% (-8.33% 🔻)
100%
88.24% (+1.87% 🔼)

Test suite run success

860 tests passing in 124 suites.

Report generated by 🧪jest coverage report action from b6d5758

@vercel
Copy link

vercel bot commented Apr 22, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
unleash-docs ✅ Ready (Inspect) Visit Preview Apr 28, 2022 at 8:51AM (UTC)

@@ -99,11 +96,11 @@
"js-yaml": "^4.1.0",
"knex": "1.0.4",
"log4js": "^6.0.0",
"make-fetch-happen": "^10.1.2",
Copy link

Choose a reason for hiding this comment

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

Critical OSS Vulnerability:

pkg:npm/make-fetch-happen@10.1.2

1 Critical, 0 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies

Components
    pkg:npm/minimatch@3.0.4
      CRITICAL Vulnerabilities (1)

        [sonatype-2021-4879] Unknown

        minimatch - Regular Expression Denial of Service (ReDoS)

        CVSS Score: 7.5

        CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

        CWE: CWE-1333

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -5048,6 +5209,28 @@ make-error@1.x, make-error@^1.1.1:
resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==

make-fetch-happen@^10.1.2:
Copy link

Choose a reason for hiding this comment

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

Critical OSS Vulnerability:

pkg:npm/make-fetch-happen@10.1.2

1 Critical, 0 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies

Components
    pkg:npm/minimatch@3.0.4
      CRITICAL Vulnerabilities (1)

        [sonatype-2021-4879] Unknown

        minimatch - Regular Expression Denial of Service (ReDoS)

        CVSS Score: 7.5

        CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

        CWE: CWE-1333

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

LGTM

@chriswk chriswk force-pushed the 739-fix-fetchretry-will-always-return-first-response branch from 36485bc to b6d5758 Compare April 28, 2022 08:49
@chriswk chriswk merged commit 3e40cb9 into main Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: fetchRetry will always return first response
2 participants