full-blockchain-solidity-course-js icon indicating copy to clipboard operation
full-blockchain-solidity-course-js copied to clipboard

TypeError: Cannot read properties of undefined (reading '0')

Open Plycedes opened this issue 1 year ago • 1 comments

Lesson

Lesson 15

Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")

No response

Operating System

Windows

Describe the bug

Everytime I try accessing the events array this happens

const tokenId = mintTxReceipt.events[0].args.tokenId;

This line or any similar line just doesn't work and I've practically scrapped the whole Web but can't find anything that may fix it. One gentleman had the same issue and he solved it but he never posted how and closed the issue.

Please help me. I've been stuck on this problem for weeks ever since we first started reading from events array back in lesson 9

Plycedes avatar Sep 16 '23 11:09 Plycedes

hello Plycedes

try it this way const tokenId = mintTxReceipt.logs[0].args.tokenId;

the-first-elder avatar Oct 05 '23 13:10 the-first-elder