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

Error: Callback was already called #100

Closed
mkg20001 opened this issue Mar 22, 2018 · 4 comments
Closed

Error: Callback was already called #100

mkg20001 opened this issue Mar 22, 2018 · 4 comments

Comments

@mkg20001
Copy link
Member

In browser this error occurs. More specifically on https://libp2p-nodetrust.tk/demo/ (ipfs://QmY4PTpLb6rFrqPnjpJY6dedMnUtAzvphoBeLWYDwKxGfA)

Uncaught (in promise) Error: Callback was already called.
    at onlyOnce.js:9
    at parallel.js:36
    at parallel (support.js:62)
    at parallel.js:39
    at once.js:12
    at iteratorCallback (eachOf.js:60)
    at onlyOnce.js:12
    at parallel.js:36
    at promise.then.res (nodeify.js:7)
    at <anonymous>
(anonymous) @ onlyOnce.js:9
(anonymous) @ parallel.js:36
parallel @ support.js:62
(anonymous) @ parallel.js:39
(anonymous) @ once.js:12
iteratorCallback @ eachOf.js:60
(anonymous) @ onlyOnce.js:12
(anonymous) @ parallel.js:36
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
exports.create @ index-browser.js:22
cb @ support.js:67
(anonymous) @ parallel.js:31
eachOfArrayLike @ eachOf.js:65
exports.default @ eachOf.js:8
exports.default @ parallel.js:30
exports.default @ parallel.js:88
exports.makeMacAndCipher @ support.js:52
cb @ crypto.js:191
(anonymous) @ parallel.js:31
eachOfArrayLike @ eachOf.js:65
exports.default @ eachOf.js:8
exports.default @ parallel.js:30
exports.default @ parallel.js:88
waterfall @ crypto.js:190
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
(anonymous) @ key-stretcher.js:101
(anonymous) @ onlyOnce.js:12
next @ whilst.js:68
m.digest @ key-stretcher.js:80
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
m.digest @ key-stretcher.js:75
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
(anonymous) @ key-stretcher.js:60
next @ whilst.js:66
m.digest @ key-stretcher.js:80
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
m.digest @ key-stretcher.js:75
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
(anonymous) @ key-stretcher.js:60
next @ whilst.js:66
m.digest @ key-stretcher.js:80
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
m.digest @ key-stretcher.js:75
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
(anonymous) @ key-stretcher.js:60
next @ whilst.js:66
m.digest @ key-stretcher.js:80
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
m.digest @ key-stretcher.js:75
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
(anonymous) @ key-stretcher.js:60
next @ whilst.js:66
m.digest @ key-stretcher.js:80
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
m.digest @ key-stretcher.js:75
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
(anonymous) @ key-stretcher.js:60
exports.default @ whilst.js:70
m.digest @ key-stretcher.js:53
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
(anonymous) @ index-browser.js:15
digest @ index-browser.js:34
hmac.create @ key-stretcher.js:45
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
exports.create @ index-browser.js:22
module.exports @ key-stretcher.js:40
waterfall @ crypto.js:167
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
genSharedKey @ ecdh-browser.js:64
cb @ crypto.js:163
nextTask @ waterfall.js:16
exports.default @ waterfall.js:26
exports.generateKeys @ crypto.js:162
cb @ exchange.js:28
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
state.key.remote.verify @ crypto.js:155
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
exports.hashAndVerify @ rsa-browser.js:76
verify @ rsa-class.js:19
exports.verify @ crypto.js:145
waterfall @ exchange.js:26
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
reader.read @ decode.js:121
drain @ index.js:39
more @ index.js:51
reader.read @ index.js:95
readMessage @ decode.js:116
reader.read @ decode.js:71
drain @ index.js:39
more @ index.js:51
reader.read @ index.js:95
(anonymous) @ decode.js:61
decodeFromReader @ decode.js:49
exports.read @ support.js:132
waterfall @ exchange.js:22
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
state.key.local.sign @ crypto.js:58
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
exports.hashAndSign @ rsa-browser.js:57
sign @ rsa-class.js:61
crypto.keys.generateEphemeralKeyPair @ crypto.js:48
promise.then.res @ nodeify.js:7
Promise.then (async)
module.exports @ nodeify.js:6
exports.generateEphmeralKeyPair @ ecdh-browser.js:18
module.exports @ ephemeral-keys.js:10
exports.createExchange @ crypto.js:33
cb @ exchange.js:19
nextTask @ waterfall.js:16
exports.default @ waterfall.js:26
module.exports @ exchange.js:18
cb @ index.js:14
(anonymous) @ parallel.js:31
replenish @ eachOfLimit.js:64
iterateeCallback @ eachOfLimit.js:49
(anonymous) @ onlyOnce.js:12
(anonymous) @ parallel.js:36
err @ propose.js:33
(anonymous) @ once.js:12
next @ waterfall.js:21
(anonymous) @ onlyOnce.js:12
support.selectBest @ crypto.js:129
exports.digest @ support.js:102
cb @ index.js:73
(anonymous) @ index.js:15
Item.run @ browser.js:153
drainQueue @ browser.js:123
setTimeout (async)
runTimeout @ browser.js:50
process.nextTick @ browser.js:143
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Multihashing.digest @ index.js:84
exports.digest @ support.js:113
exports.digest @ support.js:88
cb @ index.js:73
(anonymous) @ index.js:15
Item.run @ browser.js:153
drainQueue @ browser.js:123
setTimeout (async)
runTimeout @ browser.js:50
process.nextTick @ browser.js:143
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Multihashing.digest @ index.js:84
exports.digest @ support.js:113
exports.selectBest @ support.js:80
exports.selectProtocols @ crypto.js:110
cb @ propose.js:26
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
PeerId.createFromPubKey @ crypto.js:87
pubKey.hash @ index.js:188
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
Item.run @ browser.js:153
drainQueue @ browser.js:123
setTimeout (async)
runTimeout @ browser.js:50
process.nextTick @ browser.js:143
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
exports.createFromPubKey @ index.js:183
exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
reader.read @ decode.js:121
drain @ index.js:39
more @ index.js:51
reader.read @ index.js:95
readMessage @ decode.js:116
reader.read @ decode.js:71
drain @ index.js:39
more @ index.js:51
(anonymous) @ index.js:62
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:110
(anonymous) @ index.js:110
(anonymous) @ map.js:19
(anonymous) @ source.js:31
wrapped @ raven.js:374
@daviddias
Copy link
Member

I believe this has been fixed by #101, please double check.

@mkg20001
Copy link
Member Author

mkg20001 commented Apr 4, 2018

Just re-compiled the demo https://ipfs.io/ipfs/QmUtJxBLPe11sRbh1bSyPcrjLWBh6wagPjtoW8Ls1AASzg/demo/
This one is browserified and uglified. If I don't uglify the code then the demo works perfectly. If I uglify it the "Error: Callback was already called." error reoccurs, even if no secio connection was being established.

I think it's not related with SECIO and rather is caused by https://github.com/libp2p/js-libp2p-switch/issues/228

Error: Callback was already called.
onlyOnce.js:9
[96]</exports.default/<
onlyOnce.js:9
_doWork/<
queue.js:44
[256]</exports.default/</timer<
timeout.js:74

@fsdiogo
Copy link
Member

fsdiogo commented May 18, 2018

I don't know if this is still relevant, but in the uglify config, pass this option:

compress: { unused: false }

Check ipfs/aegir#214.

@mkg20001
Copy link
Member Author

@fsdiogo Thanks! That seems to fix this issue. (ref mkg20001/libp2p-nodetrust@455d66d#diff-7350bfb3587433477c29566176c70a1dR10)

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

No branches or pull requests

3 participants