kevinheavey / anchor-bankrun

An Anchor wrapper for solana-bankrun
MIT License
36 stars 8 forks source link

"Cannot read properties of null" on view instruction #21

Closed GuidoDipietro closed 2 months ago

GuidoDipietro commented 2 months ago

Periodically getting this error message, perhaps 9 out of 10 times, when calling a view instruction.

TypeError: Cannot read properties of null (reading 'data')
      at BankrunProvider.simulate (node_modules/anchor-bankrun/src/index.ts:218:41)
      at simulate (node_modules/@coral-xyz/anchor/src/program/namespace/simulate.ts:37:16)
      at MethodsBuilder.view [as _viewFn] (node_modules/@coral-xyz/anchor/src/program/namespace/views.ts:24:30)

Affected lines in anchor-bankrun:

const returnDataRaw = rawResult.meta.returnData;
const b64 = Buffer.from(returnDataRaw.data).toString("base64");

This happens after I call context.setAccount(), couldn't reproduce otherwise.

Probably related to #9, #10.

GuidoDipietro commented 2 months ago

Closing as not an issue, this was a different problem unrelated to the framework.