TypeError: Cannot read property 'padStart' of null

I am new to flow and trying to do a transaction.

When i initiate the transection it makes same api call 6 time, not sure why?
Then i get TypeError: Cannot read property ‘padStart’ of null.

send-get-account.js:12 Uncaught (in promise) TypeError: Cannot read property 'padStart' of null
at send-get-account.js:12

Please help me to figure out what is happening here, looks like the issue is in JS SDK.

@gregsantos @JeffreyDoyle Any ideas for what is happening here?

@jhaankit I was running into this issue as well, was able to resolve.

I believe in my case, the root cause of this issue was incorrectly setting the Authorization function when calling fcl.payer, fcl.proposer, fcl.authorizations. I was initially rolling my own Authorization function modeling off of this post and the Kitty-Items implementation shown in authorizeMinter() here.

I’ve since made the following update to my transaction code:

  const txId = await fcl
    .send([
      CODE,
      fcl.payer(sdk.authorization(process.env.FLOW_SMART_CONTRACT_PROFILE, signingFunction, 0)),
      fcl.proposer(sdk.authorization(process.env.FLOW_SMART_CONTRACT_PROFILE, signingFunction, 0)),
      fcl.authorizations([sdk.authorization(process.env.FLOW_SMART_CONTRACT_PROFILE, signingFunction, 0)]),
      fcl.limit(35),
    ])
    .then(fcl.decode)

I’m using fcl for scaffolding the transaction, then just using the sdk for its authorization method.

My signingFunction is implemented following the post I linked above.

2 Likes

Hi @namadaz , Thanks for this answer. I was really looking for this. I am still facing the same error. Can you provide me your authorisation code and signing function ? I have followed both of the posts which you have mentioned but still found no success in it. Thanks in advance. Please help me out.
@gregsantos @JeffreyDoyle @flowjosh @qvvg I need your help guys.