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

Cannot read property 'length' of undefined #283

Closed
leegod opened this issue May 12, 2019 · 3 comments
Closed

Cannot read property 'length' of undefined #283

leegod opened this issue May 12, 2019 · 3 comments

Comments

@leegod
Copy link

leegod commented May 12, 2019

root@vmi265048:~/explorer# node scripts/sync.js index reindex
script launched with pid: 25104
Unable to connect to explorer API
index cleared (reindex)
/root/explorer/lib/database.js:642
lib.syncLoop(block.tx.length, function (subloop) {
^

TypeError: Cannot read property 'length' of undefined
at /root/explorer/lib/database.js:642:36
at Request._callback (/root/explorer/lib/explorer.js:107:14)
at Request.self.callback (/root/explorer/node_modules/request/request.js:187:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request. (/root/explorer/node_modules/request/request.js:1044:10)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at IncomingMessage. (/root/explorer/node_modules/request/request.js:965:12)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:441:9)
at process._tickCallback (node.js:355:17)

I tried everything solutions found google.
rpcport and .conf and match it at settings.json, restart, revise code at explorer.js 341 line...

Nothing works.

My daemon, I ran by ./mycoind -daemon -reindex -txindex
but like 10-20 mins later after running still its getblockcount returns 0 now.
Is this normal?

Anyway, how can I solve above explorer's length problem?

@leegod
Copy link
Author

leegod commented May 12, 2019

So while after waiting more, coind started to sync, and then explorer's sync.js started to works. But while updating blocks, there are many tx.vout............ block, is this because I revised explorer.js 341 line with codes provided by in this issue board?

@uaktags
Copy link
Collaborator

uaktags commented May 26, 2019

My guess is there's any issue with the data that is returned by the daemon and parsed by the npm modules.

Atleast in terms of the original error, if you were still having that, I would suggest the following to see for yourself what is wrong:

if (block) {

 if (block) {
console.log(block) //I would add this line to see what block is, which was provided on L640 by explorer.js#get_block
lib.syncLoop(block.tx.length, function (subloop) {

Obviously though, this is a moot point already if you've gotten past this.

@TheHolyRoger
Copy link
Collaborator

Dup of #56

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

3 participants