truffle debug => Cannot read property 'structLogs' of undefined

Created on 8 Oct 2017  路  25Comments  路  Source: trufflesuite/truffle

  • [ ] I've asked for help in the Truffle Gitter before filing this issue.

Issue

i try to use debug a tx but get an error

Steps to Reproduce

truffle compile truffle migrate --reset --network rinkeby truffle debug 0x695ae3744b76f9adcdfd034dd0824266444f914d6b91699b9d0ccf73b1f32b94 --network rinkeby

Expected Behavior

i expected to be walked through the transaction to see why it ran out of gas

Actual Results

instead i received this error:
````
Gathering transaction data...

/Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:333580
accept(result.result.structLogs);
^

TypeError: Cannot read property 'structLogs' of undefined
at /Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:333580:27
at /Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:322668:9
at XMLHttpRequest.request.onreadystatechange (/Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:324093:13)
at XMLHttpRequestEventTarget.dispatchEvent (/Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:71245:18)
at XMLHttpRequest._setReadyState (/Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:71535:12)
at XMLHttpRequest._onHttpResponseEnd (/Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:71690:12)
at IncomingMessage. (/Users/billy/.nvm/versions/node/v7.2.0/lib/node_modules/truffle/build/cli.bundled.js:71650:24)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
````

Environment

  • Operating System: macOS Sierra 10.12.5
  • Truffle version: Truffle v4.0.0-beta.0 (core: 4.0.0-beta.0)
  • Ethereum client:
    Geth Version: 1.6.7-stable Git Commit: ab5646c532292b51e319f290afccf6a44f874372 Architecture: amd64 Protocol Versions: [63 62] Network Id: 1 Go Version: go1.8.3 Operating System: darwin GOPATH= GOROOT=/usr/local/Cellar/go/1.8.3/libexec
  • node version: v7.2.0
  • npm version: 3.10.9

Most helpful comment

I was still facing this issue with truffle 4.0.4 & 4.0.5 with the latest ganache-cli v6.1.0-beta.0
I had to manually edit truffle's cli js found here to fix it:
C:Users\\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js

The error message gives out the line causing this error.
In my case it was in this method: Debugger.prototype.getTrace
I added a
console.info(result);
before the line accessing structLogs:
accept(result.result.structLogs)

Turned out that the getTrace call was rejected by the evm saying that there is a mismatch in the number of params being passed.
So changed this line:
params: [tx_hash],
to
params: [tx_hash, {}],

That fixed it for me. For others, the reason might not be the same, but you can follow the same steps to figure out what it is.

HTH.

All 25 comments

Hi there. You should be able to fix this by updating your version of the TestRPC.

Please update to the latest version, and comment here if that does not fix your issue. Thanks!

I'm having the exact same issue.
Updated TestRPC & Geth and I'm using Geth regardless.

I'm having the same issue, debugging on the main net with geth 1.7.2

I upgraded to Ganache CLI v6.0.3 but getting the same error

Walking down the tutorial of http://truffleframework.com/tutorials/debugging-a-smart-contract and I experience the same error with geth v1.7.3-stable and Truffle v4.0.1

same issue here
Truffle v4.0.1
EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)

Same here with Truffle v4.0.1
Node v8.8.1
npm 5.4.2
Tried built in develop mode and Ganache

Also getting this - Truffle v4.0.1 | TestRPC v6.0.3

I've encountered this too, exactly as described. It appears to be very inconsistent, with no discernible pattern. We'll need to investigate further.

Same

Having the same issue here. Maybe this needs to be reopened?

Having this issue as well

same issue

Truffle v4.0.4
geth 1.7.3

Same Issue here when using truffle debug...

Also experiencing this under the same setup using the newest version of Ganache.

Previews week i was able to buyTokens from my contract using my api now i get the following error:

screenshot from 2018-01-14 16-09-33

Then i try to debug transaction hash using:

truffle debug 0xa3ab41a32a00408f2f67b943f9aca529b940279b00defb0616ce59aab579000e

and i got the following error:

TypeError: Cannot read property 'structLogs' of undefined

Any recommendations ?
I think issue is related with https://github.com/trufflesuite/truffle/issues/748
i am facing both problems...

Regards,
Kristiyan Tachev

same issue

Truffle v4.0.4
parity v1.8.6

i am getting the same issue.

Truffle v4.0.5. Getting error as "TypeError: Cannot read property 'structLogs' of undefined". Is there any additional configuration required?

Hi, I got the same issue and may find out the problem: did you have a ; at the end of command? don't do that! See below two times running the same thing, the first failed because a ";" at the end and the second works.

truffle(develop)> debug 0x6ce1c4abfb24279ea38b0003bbe96fa650e3a64019d610ca747fb55cd8eca613;

Note: This feature's in beta. Please discuss any issues you find in our Gitter channel!
https://gitter.im/ConsenSys/truffle

Gathering transaction data...

TypeError: Cannot read property 'structLogs' of undefined
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:323399:28
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:325200:9
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328229:7)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176415:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176705:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176860:12)
truffle(develop)> debug 0x6ce1c4abfb24279ea38b0003bbe96fa650e3a64019d610ca747fb55cd8eca613

Note: This feature's in beta. Please discuss any issues you find in our Gitter channel!
https://gitter.im/ConsenSys/truffle

Gathering transaction data...

Addresses affected:

I was still facing this issue with truffle 4.0.4 & 4.0.5 with the latest ganache-cli v6.1.0-beta.0
I had to manually edit truffle's cli js found here to fix it:
C:Users\\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js

The error message gives out the line causing this error.
In my case it was in this method: Debugger.prototype.getTrace
I added a
console.info(result);
before the line accessing structLogs:
accept(result.result.structLogs)

Turned out that the getTrace call was rejected by the evm saying that there is a mismatch in the number of params being passed.
So changed this line:
params: [tx_hash],
to
params: [tx_hash, {}],

That fixed it for me. For others, the reason might not be the same, but you can follow the same steps to figure out what it is.

HTH.

same issue:
Truffle v4.0.6
ganache-1.1.0-beta.0-x86_64.AppImage

I've successfully followed @saradotramli's instructions, things just started to work.

same issue

By following @saradotramli's debugging instructions, I noticed that for me the problem was:

{ jsonrpc: '2.0',
  error: { code: -32601, message: 'Method not found' },
  id: 1520947668993 }

This is because my Parity does not support (yet) "debug_traceTransaction" (https://github.com/paritytech/parity/issues/4858)

In my case, this is not Truffle's problem, but the error could be a bit more informative :D

Following @saradotramli method I was able to get further, I then ran into
TypeError: Cannot read property 'line' of undefined at Object.formatRangeLines (\node_modules\truffle\build\webpack:\~\truffle-debug-utils\index.js:211:1)

So as a quick fix, I just added the following two lines to this method:

formatRangeLines: function(source, range, contextBefore) {
    range.start = range.start || {line: 0, column: 0};
    range.end = range.end || {line: 0, column: 0};
Was this page helpful?
0 / 5 - 0 ratings

Related issues

timothywangdev picture timothywangdev  路  3Comments

rjl493456442 picture rjl493456442  路  4Comments

rotcivegaf picture rotcivegaf  路  3Comments

abcoathup picture abcoathup  路  3Comments

hefgi picture hefgi  路  3Comments