TypeError: Cannot read property 'lamports' of null

I was trying to build a function to transfer sol using “SystemProgram.transfer” but getting this error. Can anyone help me out to resolve the error.

(node:23768) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘lamports’ of null
at F:\soltut\solana\dist\show-balance\index.js:18:21
at Generator.next ()
at fulfilled (F:\soltut\solana\dist\show-balance\index.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:23768) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see Command-line API | Node.js v17.9.0 Documentation). (rejection id:
(node:23768) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can you show the contents of your file: F:\soltut\solana\dist\show-balance\index.js:18:21?

It’s small mistake in your code from the sound of it, but I’d need to see the code to give any tips.

Thanks for reply, but Issue resolved, I was trying to airdrop 4 sol on devnet, but when i tryed with less sol (2 sols) it worked.
I think we cannot get more then 2 sols airdroped on devnet at a time.

1 Like