Browserify: crypto no longer works

Created on 11 May 2017  路  10Comments  路  Source: browserify/browserify

It looks like something broke crypto with changes pushed today. Did not investigate where the change came from so I am reporting it here.

To reproduce:

var crypto = require('crypto')

This will produce the following error:

index.js:3 Uncaught TypeError: Cannot read property 'toString' of undefined
    at Object.require.270.crypto (index.js:3)
    at s (_prelude.js:1)
    at _prelude.js:1
    at Object.require.164.browserify-cipher (index.js:12)
    at s (_prelude.js:1)
    at _prelude.js:1
    at Object.require.1.../../src/example (index.js:7)
    at s (_prelude.js:1)
    at e (_prelude.js:1)
    at _prelude.js:1

where:

crypto.pbkdf2Sync.toString()

will is called on undefined object, i.e. crypto.pbkdf2Sync is not defined.

Again, this regression is relatively new. Perhaps due to a change from today.

Most helpful comment

Issue is fixed in the new version of pbkdf2(3.0.12)

All 10 comments

Facing the same issue in crypto.pbkdf2Sync.toString()

There are no changes that were pushed today. Must be a dependency that pushed changes that is breaking this. crypto-browserify was my first thought, but that doesn't seem to have been updated either https://github.com/crypto-browserify/crypto-browserify. Maybe it's a dependency of crypto-browserify?

Looking at https://github.com/crypto-browserify/createHash as a likely candidate for the regression.

Issue is fixed in the new version of pbkdf2(3.0.12)

I was just going down that rabbit hole, thanks for the reply!

@vivek0tiwari Confirmed the issue is now resolved. @pdparchitect try renpm iing browserify.

Yes fixed!

I'm still seeing this when I do import crypto from 'crypto'.

also still see the same error here..

Same for me...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thlorenz picture thlorenz  路  5Comments

ericmorand picture ericmorand  路  4Comments

jasonkarns picture jasonkarns  路  5Comments

connor11528 picture connor11528  路  6Comments

flowerornament picture flowerornament  路  12Comments