Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

error while installing jspm packages #129

Open
sona-kumari opened this issue Feb 8, 2021 · 23 comments
Open

error while installing jspm packages #129

sona-kumari opened this issue Feb 8, 2021 · 23 comments

Comments

@sona-kumari
Copy link

I am getting the below error, for installing jspm packages. i hhave verified the credentials its fine. Please let me know what could be the issue. this is the error in our CI/CD pipeline. which was working previously. but has been failing since friday(5th Feb 2021).

**warn Error on getPackageConfig for github:systemjs/plugin-text
TypeError: Cannot read property 'match' of undefined
at checkRateLimit (D:\a\1\s\HttpApi\node_modules\jspm-github\github.js:276:22)
at D:\a\1\s\HttpApi\node_modules\jspm-github\github.js:456:46
at tryCatch (D:\a\1\s\HttpApi\node_modules\rsvp\dist\rsvp.js:525:12)
at invokeCallback (D:\a\1\s\HttpApi\node_modules\rsvp\dist\rsvp.js:538:13)
at publish (D:\a\1\s\HttpApi\node_modules\rsvp\dist\rsvp.js:508:7)
at flush (D:\a\1\s\HttpApi\node_modules\rsvp\dist\rsvp.js:2415:5)
at process._tickCallback (internal/process/next_tick.js:176:11)

warn Error getting package config for github:systemjs/plugin-text.
Downloading npm:[email protected]
Looking up npm:source-map
Downloading npm:[email protected]**

@gvmobile
Copy link

gvmobile commented Feb 8, 2021

We found the issue in this line of code:

if (res.headers.status.match(/^401/))

It seems like Github API isn't sending the "status" anymore in the response header.
curl

@sona-kumari
Copy link
Author

so what do you suggest the resolution for this should be. below is my authentication code. i have verified my authkey. it is perfectly valid.

call %node% %jspm% config registries.github.remote https://github.jspm.io
call %node% %jspm% config registries.github.maxRepoSize 0
call %node% %jspm% config registries.github.auth %githubAuthKey%
call %node% %jspm% config registries.github.handler jspm-github

@sudha50
Copy link

sudha50 commented Feb 9, 2021

we faced the same issue in our Jenkins environment
warn Error on getPackageConfig for github:systemjs/plugin-css
TypeError: Cannot read property 'match' of undefined
at checkRateLimit (/home/ec2-user/workspace/Build/UI/online@2/node_modules/jspm-github/github.js:276:21)
warn Error on download for github:d-oliveros/ngSmoothScroll
TypeError: Cannot read property 'match' of undefined
at checkRateLimit (/home/ec2-user/workspace/Build/UI/online@2/node_modules/jspm-github/github.js:276:21)

 But somehow,  we're able to build in our laptops.
 Currently, we're blocked on this issue.

@khanharis87
Copy link

@jonatastrife
Copy link

so what do you suggest the resolution for this should be. below is my authentication code. i have verified my authkey. it is perfectly valid.

call %node% %jspm% config registries.github.remote https://github.jspm.io call %node% %jspm% config registries.github.maxRepoSize 0 call %node% %jspm% config registries.github.auth %githubAuthKey% call %node% %jspm% config registries.github.handler jspm-github

We need to know if the Github API changed somehow and stopped sending the status in the response header like it was supposed to do according to their documentation.

Github API
So if they changed that, we need do make an adjustment in the jspm to don't expect that while checking if the rate limit was reached.
If it's a bug in github API, we need to try to find out why it happened with Github support.

@kristofer84
Copy link

kristofer84 commented Feb 9, 2021

Sharing my really temporary solution to get my Docker containers working again:

@thulin82
Copy link

thulin82 commented Feb 9, 2021

@jonatastrife That's major. My though was the entire time that it was something that GitHub just removed, but if it's in the documentation, then I guess it's a bug?

Have anyone been in contact with GitHub (support)?

@yafanasiev
Copy link

Also encountered this issue, made a fix similar to @kristofer84 :

function checkRateLimit(status, headers) {
  if (status === 401)
    throw 'Unauthorized response for GitHub API.\n' +
      'Use %jspm registry config github% to reconfigure the credentials, or update them in your ~/.netrc file.';
  if (status === 406)
    throw 'Unauthorized response for GitHub API.\n' +
...
...
    )).then(function(res) {
      var rateLimitResponse = checkRateLimit.call(this, res.statusCode, res.headers);
...

...and copy over modified file to node_modules: cp "./tools/BuildScripts/github.js" "./node_modules/jspm-github"

@Spaceman1861
Copy link

I know this is a super lame workaround but It helped me fixed my build pipeline...

  1. Rip this folder from your node_modules "jspm-github" and make a copy somewhere in your base directory.
  2. Modify checkRateLimit method to this.
  //if (headers.status.match(/^401/))
  //  throw 'Unauthorized response for GitHub API.\n' +
  //    'Use %jspm registry config github% to reconfigure the credentials, or update them in your ~/.netrc file.';
  //if (headers.status.match(/^406/))
  //  throw 'Unauthorized response for GitHub API.\n' +
  //    'If using an access token ensure it has public_repo access.\n' +
  //    'Use %jspm registry config github% to configure the credentials, or add them to your ~/.netrc file.';

  if (headers['x-ratelimit-remaining'] != '0')
    return;

  var remaining = (headers['x-ratelimit-reset'] * 1000 - new Date(headers.date).getTime()) / 60000;

  if (this.auth)
    return Promise.reject('\nGitHub rate limit reached, with authentication enabled.' +
        '\nThe rate limit will reset in `' + Math.round(remaining) + ' minutes`.');

  var err = new Error('GitHub rate limit reached.');
  err.config = true;
  err.hideStack = true;

  return Promise.reject(err);
}
  1. Remove the existing module and add the new custom module.
  2. npm install --save ./jspm-github

Hope that helps anyone stuck.

@Spaceman1861
Copy link

Looks like 2 people got to it before me while I was writing my post ><

@thulin82
Copy link

thulin82 commented Feb 9, 2021

https://github.community/t/missing-status-in-response-header/160558

@thulin82
Copy link

thulin82 commented Feb 9, 2021

Our solution to the problem (similar to others), create a local copy of github.js, with the header.status.match-parts behind an if-block. Commit that file to the repo.

In the build chain (azure devops), after "npm install", create a new step which copies the above mentioned github.js into the place of the one that was created during "npm install".

@DatumPlatformInteractive

thank you @yafanasiev your fix worked for me.

@yafanasiev
Copy link

Considering Github may not treat this as a bug, and it's more reliable to use status code from response object anyway, should we just switch to that? I can make a PR for this.

@jonatastrife
Copy link

Sharing my really temporary solution to get my Docker containers working again:

In my org we are doing basically the same thing, we made our own modification to the file and are downloading it after the first npm install in azure devops and replacing it in jspm-github\github.js , we finally revived our CI pipeline with this. So now that we have more time to think, did anyone try to contact Github Support?

@jimthedev
Copy link

@yafanasiev that sounds wonderful. At this point whatever works to get unstuck.

@guybedford
Copy link
Member

I've published a 0.13.21 of the jspm-github with a possible fix for this. Blasting out the lock / node_modules on a jspm install should bring in this version since it's in the semver range.

Please let me know if any issues with this still stand though.

@fMads
Copy link

fMads commented Feb 10, 2021

I've published a 0.13.21 of the jspm-github with a possible fix for this. Blasting out the lock / node_modules on a jspm install should bring in this version since it's in the semver range.

Please let me know if any issues with this still stand though.

Could you update version 0.14 with the changes too? :)
It's required by [email protected], which we still use

@LukeTPerry
Copy link

In my org we are doing basically the same thing, we made our own modification to the file and are downloading it after the first npm install in azure devops and replacing it in jspm-github\github.js , we finally revived our CI pipeline with this. So now that we have more time to think, did anyone try to contact Github Support?

In the support link above (https://github.community/t/missing-status-in-response-header/160558) Github have replied indicating a change occurred and that it would not be rolled back. Documentation is to be updated instead.

@guybedford
Copy link
Member

@fMads sure I've published a 0.14.14 as well for jspm 0.17.

I must say it's quite nice to hear the project is still appreciated and used, as as an OSS developer one gets zero feedback until things break. jspm 3 will be coming out next month, and is quite a difference, follow jspm on Twitter if you're interested in the announcement.

@jimthedev
Copy link

@fMads sure I've published a 0.14.14 as well for jspm 0.17.

I must say it's quite nice to hear the project is still appreciated and used, as as an OSS developer one gets zero feedback until things break. jspm 3 will be coming out next month, and is quite a difference, follow jspm on Twitter if you're interested in the announcement.

On behalf of us all @guybedford. Thank you.

@khanharis87
Copy link

thanks @guybedford I am trying to npm install [email protected] but getting No matching version found.

@jimthedev
Copy link

thanks @guybedford I am trying to npm install [email protected] but getting No matching version found.

I am not sure but for us we just deleted our lock file and re-ran npm install. You don’t actually need to explicitly install anything since this is in the semver range. If you need to explicitly install it for some reason the version for [email protected]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests