w3f / staking-rewards-collector

Apache License 2.0
78 stars 32 forks source link

Cannot read property 'price' of undefined #47

Closed TriplEight closed 2 years ago

TriplEight commented 2 years ago

How do I debug this error?

$ yarn start
yarn run v1.22.18
$ node src/index.js
TypeError: Cannot read property 'price' of undefined
    at addPriceData (file:///home/tripleight/code/github.com/tripleight/staking-rewards-collector/src/api.js:20:76)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async gatherData (file:///home/tripleight/code/github.com/tripleight/staking-rewards-collector/src/gatherData.js:15:15)
    at async main (file:///home/tripleight/code/github.com/tripleight/staking-rewards-collector/src/index.js:48:11)
Done in 2.98s.
jonasW3F commented 2 years ago

That might happen if the coingecko API does not return a price but the script wants to access it. You want to narrow the issue down by checking with account causes this error (and which chain), then check the dates that you request prices for. If you want to share the userInput.json with me (sending it in private), I could take a look, but it would expose your account to me.

jonasW3F commented 2 years ago

@TriplEight There might be a bug in the current version, that I just found that is responsible for this. In some edge cases this could occur. Will update this issue when I think it is fixed.

jonasW3F commented 2 years ago

The issue should be fixed in https://github.com/w3f/staking-rewards-collector/pull/51 - Could you check again?

jonasW3F commented 2 years ago

Should be fixed with v1.7.0