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

TypeError: Cannot read property 'PrivKey' of undefined && Uncaught Error: Callback was already called. #963

@kaminono

Description

@kaminono
  • Version:
    js-ipfs version: 0.25.1

  • Platform:
    Darwin localhost 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

  • Subsystem:

Type:

Bug

Severity:

High

Description:

init local jsipfs repo

and then init ipfs

BUT

Console ->

pre-start.js:19 Uncaught TypeError: Cannot read property 'PrivKey' of undefined
    at waterfall (pre-start.js:19)
    at nextTask (waterfall.js:16)
    at next (waterfall.js:23)
    at onlyOnce.js:12
    at store.get (config.js:45)
    at levelup.js:211
    at IDBRequest.req.onsuccess (index.js:125)
waterfall @ pre-start.js:19
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
store.get @ config.js:45
(anonymous) @ levelup.js:211
req.onsuccess @ index.js:125
IndexedDB (async)
Level._get @ index.js:101
AbstractLevelDOWN.get @ abstract-leveldown.js:94
LevelUP.get @ levelup.js:195
get @ index.js:42
get @ config.js:32
waterfall @ pre-start.js:17
nextTask @ waterfall.js:16
exports.default @ waterfall.js:26
(anonymous) @ pre-start.js:16
series @ boot.js:31
(anonymous) @ parallel.js:31
replenish @ eachOfLimit.js:64
iterateeCallback @ eachOfLimit.js:49
(anonymous) @ onlyOnce.js:12
(anonymous) @ parallel.js:36
waterfall @ index.js:123
(anonymous) @ once.js:12
next @ waterfall.js:21
(anonymous) @ onlyOnce.js:12
waterfall @ index.js:110
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
waterfall @ index.js:105
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
maybeWithSharding @ blockstore.js:37
setImmediate @ blockstore.js:46
(anonymous) @ setImmediate.js:27
Item.run @ browser.js:153
drainQueue @ browser.js:123
setTimeout (async)
runTimeout @ browser.js:41
process.nextTick @ browser.js:143
(anonymous) @ setImmediate.js:26
exports.lock @ lock-memory.js:31
waterfall @ index.js:87
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
parallel @ index.js:151
(anonymous) @ parallel.js:39
(anonymous) @ once.js:12
iterateeCallback @ eachOfLimit.js:47
(anonymous) @ onlyOnce.js:12
(anonymous) @ parallel.js:36
get @ version.js:59
store.get @ version.js:31
(anonymous) @ levelup.js:211
req.onsuccess @ index.js:125
IndexedDB (async)
Level._get @ index.js:101
AbstractLevelDOWN.get @ abstract-leveldown.js:94
LevelUP.get @ levelup.js:195
get @ index.js:42
get @ version.js:27
check @ version.js:51
version @ index.js:140
(anonymous) @ parallel.js:31
replenish @ eachOfLimit.js:64
(anonymous) @ eachOfLimit.js:68
eachOfLimit @ eachOfLimit.js:39
(anonymous) @ doLimit.js:9
exports.default @ eachOf.js:9
_parallel @ parallel.js:30
parallelLimit @ parallel.js:88
_isInitialized @ index.js:137
waterfall @ index.js:86
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
(anonymous) @ index.js:203
(anonymous) @ levelup.js:100
g @ events.js:165
EventEmitter.emit @ events.js:78
(anonymous) @ levelup.js:123
(anonymous) @ abstract-leveldown.js:42
onsuccess @ index.js:88
req.onsuccess @ index.js:40
IndexedDB (async)
Level._open @ index.js:37
AbstractLevelDOWN.open @ abstract-leveldown.js:36
LevelUP.open @ levelup.js:115
LevelUP @ levelup.js:84
LevelUP @ levelup.js:45
LevelDatastore @ index.js:27
createBackend @ backends.js:6
IpfsRepo @ index.js:46
module.exports @ repo-browser.js:7
IPFS @ index.js:45
1002.ipfs @ app.js:30
s @ _prelude.js:1
e @ _prelude.js:1
(anonymous) @ _prelude.js:1
onlyOnce.js:9 Uncaught Error: Callback was already called.
    at onlyOnce.js:9
    at store.get (config.js:33)
    at dispatchError (util.js:22)
    at levelup.js:203
    at IDBTransaction.tx.onabort (index.js:104)

Steps to reproduce the error:

code:

/src/app.js

const  IPFS = require('ipfs')

const Repo = require('ipfs-repo')

const  repo_path = "/Users/xiaoyu/.jsipfs"
const repo = new Repo(repo_path)


repo.init({ cool: 'config' }, (err) => {
    if (err) {
        throw err
    }

    repo.open((err) => {
        if (err) {
            throw err
        }

        console.log('repo is ready')
    })
})

const ipfs = new IPFS(
    {
        repo:repo_path,


        start: true,
        EXPERIMENTAL:{
            pubsub:true
        }

    }
)

package.json

{
  "name": "ipfs-pubsub-chat",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "http-server -c-1 -p 12321 public",
    "compile": "browserify src/app.js -o public/js/app.js -d"
  },
  "author": "xiaoyu",
  "license": "ISC",
  "dependencies": {
    "browserify": "^14.4.0",
    "datastore-level": "^0.6.0",
    "http-server": "^0.10.0",
    "ipfs": "^0.25.2",
    "ipfs-repo": "^0.17.0"
  }
}

commands

[email protected]➤ npm start

> [email protected] start /Users/xiaoyu/ipfs_projects/ipfs-pubsub-chat
> http-server -c-1 -p 12321 public

Starting up http-server, serving public
Available on:
  http://127.0.0.1:12321
  http://192.168.0.104:12321
Hit CTRL-C to stop the server
[Sun Aug 27 2017 03:20:14 GMT+0800 (CST)] "GET /" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36"
[Sun Aug 27 2017 03:20:14 GMT+0800 (CST)] "GET /js/app.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36"






[email protected]➤ npm run compile

> [email protected] compile /Users/xiaoyu/ipfs_projects/ipfs-pubsub-chat
> browserify src/app.js -o public/js/app.js -d

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions