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

Error: Algorithm "sha1" not supported. supported values: passthrough #41

Closed
ccorcos opened this issue Nov 30, 2016 · 11 comments
Closed

Comments

@ccorcos
Copy link

ccorcos commented Nov 30, 2016

I originally posted this on the eslint-loader project webpack-contrib/eslint-loader#128

Module build failed: Error: Algorithm "sha1"  not supported. supported values: passthrough
  at applyDefaults (/Users/chet/Code/doug/packages/doug/node_modules/object-hash/index.js:89:11)
  at objectHash (/Users/chet/Code/doug/packages/doug/node_modules/object-hash/index.js:31:13)
  at Object.module.exports (/Users/chet/Code/doug/packages/doug/node_modules/eslint-loader/index.js:155:20)

No idea what thats all about:

~ ❯❯❯ node --version
v6.3.1
~ ❯❯❯ node
> crypto.getHashes()
[ 'DSA',
  'DSA-SHA',
  'DSA-SHA1',
  'DSA-SHA1-old',
  'RSA-MD4',
  'RSA-MD5',
  'RSA-MDC2',
  'RSA-RIPEMD160',
  'RSA-SHA',
  'RSA-SHA1',
  'RSA-SHA1-2',
  'RSA-SHA224',
  'RSA-SHA256',
  'RSA-SHA384',
  'RSA-SHA512',
  'dsaEncryption',
  'dsaWithSHA',
  'dsaWithSHA1',
  'dss1',
  'ecdsa-with-SHA1',
  'md4',
  'md4WithRSAEncryption',
  'md5',
  'md5WithRSAEncryption',
  'mdc2',
  'mdc2WithRSA',
  'ripemd',
  'ripemd160',
  'ripemd160WithRSA',
  'rmd160',
  'sha',
  'sha1',
  'sha1WithRSAEncryption',
  'sha224',
  'sha224WithRSAEncryption',
  'sha256',
  'sha256WithRSAEncryption',
  'sha384',
  'sha384WithRSAEncryption',
  'sha512',
  'sha512WithRSAEncryption',
  'shaWithRSAEncryption',
  'ssl2-md5',
  'ssl3-md5',
  'ssl3-sha1',
  'whirlpool' ]
@addaleax
Copy link
Collaborator

addaleax commented Dec 1, 2016

This seems weird. Could you show instructions for reproducing the original error you are seeing?

Also, does npm ls|grep object-hash give you the latest version of object-hash (1.1.5)?

@ccorcos
Copy link
Author

ccorcos commented Dec 1, 2016

yes, 1.1.5

you can see if you can reproduce it on your end (the sed command enables eslint which is using object hash here):

cd /tmp
git clone [email protected]:ccorcos/doug.git
npm install --global lerna@prerelease
cd doug
lerna bootstrap
cd packages/doug-app/webpack
sed -i '' -e 's/\/\/ require/require/g' base.js
cd ../../example-app
npm start

You can see the result when I run the following:

https://gist.github.com/ccorcos/4fdbc1416111506299234be538ac30e6

@addaleax
Copy link
Collaborator

addaleax commented Dec 1, 2016

You are experiencing montagejs/collections#162, this has nothing to do with object-hash. The collections module is overriding language built-ins like Array.from, which is something you are never supposed to do (and issues like this are the reason for that).

The dependency chain for that is doug → gh-pages → q-io → collections.
I don’t know what options you have here, but you are pretty much stuck with patching collections yourself, lobbying really hard for that issue to get fixed, or removing one dependency in that chain.
There is an issue at tschaub/gh-pages#42, so if you want to work on that, I’d suggest doing it at the gh-pages level.

I’m closing this as it’s not an issue with eslint-loader or object-hash; feel free to ask any follow-up questions, though.

@addaleax addaleax closed this as completed Dec 1, 2016
@ccorcos
Copy link
Author

ccorcos commented Dec 2, 2016

thank you so much for the help! that's so annoying -- this is a perfect example of why you shouldnt override prototypes.

@ccorcos
Copy link
Author

ccorcos commented Dec 2, 2016

also, how did you find that?

@addaleax
Copy link
Collaborator

addaleax commented Dec 2, 2016

also, how did you find that?

So… I looked up the script that was actually getting executed (I think that was packages/example-app/node_modules/.bin/doug-app) and had a kinda good idea of what the problem was, judging from your report. I felt like crypto.getHashes() got overwritten or mocked or whatever, so what I did was I insert a console.log(require('crypto').getHashes().includes('sha1')) line, once at the beginning of the file and once at the end of the file.
When placing that line at the beginning it gave true, at the end it gave false, so that seemed to support my first idea, and from there on I “bisected” through the statements by moving the console.log around, and following the requires that appeared to be responsible.
And yeah, once I had narrowed it down to the overwritten Array.from being responsible, I just inserted a console.trace(values) in there, and that pretty much confirmed that that kind of shimming did not work well…

@ccorcos
Copy link
Author

ccorcos commented Dec 2, 2016

Oh interesting. console.trace(values) -- is that going to log the stack trace of where that variable is passed?!

@addaleax
Copy link
Collaborator

addaleax commented Dec 2, 2016

console.trace(values) is basically just console.log(values) + console.log(new Error().stack) – nothing too fancy. 😄

@fo2w
Copy link

fo2w commented Mar 13, 2017

same issue, is there a solution?

@addaleax
Copy link
Collaborator

@fo2w Can you give more details, like a reproduction, or the output of npm ls?

@d-a-g-e
Copy link

d-a-g-e commented Nov 8, 2017

Error: Algorithm "sha1" not supported. supported values: passthrough
this work form me D:
hash(obj, { algorithm: 'passthrough' }

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

No branches or pull requests

4 participants