# Value undefined only in AutoTask

**URL:** <https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957>\
**Category:** Defender\
**Created:** [June 26, 2022, 6:07pm UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957 "2022-06-26T18:07:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![DirtyCajunRice](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dirtycajunrice/32/15491_2.png) [@DirtyCajunRice](https://forum.openzeppelin.com/u/DirtyCajunRice)\
**Post date:** [June 26, 2022, 6:07pm UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/1 "2022-06-26T18:07:24Z")

</div>

I have an AutoTask that is triggered from a sentinel, and when i run it locally, everything works perfectly, but when It is triggered via the match condition of an event, i get an error that doesnt make sense.

**💻 Environment**

Sentinel -\> AutoTask -\> Relayer

**📝Details**  
Error message when triggered from sentinel:

```auto
invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2)

```

This error happens when at the contract function call.  
I have console.log()'d the output of every variable and they are all correct, so i am at quite a loss here. Any suggestions?

**🔢 Code to reproduce**

```auto
const { utils, Contract } = require('ethers');
const { DefenderRelaySigner, DefenderRelayProvider } = require('defender-relay-client/lib/ethers');

const tokenMapping = {
  '0x114B697750CE6efd7D935F019d2460984Bc76942': '0xe48C74833ce6f18A8e54f73f1D02B8E9f9Ff8Caa',
}

const ABI = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"BridgedNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address[]","name":"nfts","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"BridgedNFTs","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"BridgedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address[]","name":"_nfts","type":"address[]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"batchBridgeNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"batchBridgeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"bridgeNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"bridgeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"bridgeable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"disableAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"enableAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

const ingressAddress = '0x5f332f313E873E6D1d51F7853f4a6AD0446D0907';

exports.main = async function(signer, match) {
  const contract = new Contract(ingressAddress, ABI, signer);
  switch (match.signature) {
    case 'BridgedToken(address,address,uint256)': {
      const [to, sourceToken, amount] = match.args;
      console.log(to, sourceToken, tokenMapping[sourceToken], amount);
      const txRes = await contract.bridgeToken(to, tokenMapping[sourceToken], utils.parseUnits(amount, 0));
      await txRes.wait(1);
      return txRes.hash;
    }
    default: {
      console.log("No matching signature", match);
    }
  }
}

exports.handler = async function(event) {
  const provider = new DefenderRelayProvider(event);
  const signer = new DefenderRelaySigner(event, provider, { speed: 'fast' });
  return exports.main(signer, event.request.body.matchReasons[0]);
}

// To run locally (this code will not be executed in Autotasks)
if (require.main === module) {
  require('dotenv').config();
  const { DEFENDER_API_KEY: apiKey, DEFENDER_API_SECRET: apiSecret } = process.env;

  const request = {
    body: {
      matchReasons: [
        {
          type: 'event',
          signature: 'BridgedToken(address,address,uint256)',
          address: '0xba9564732102222bdbf54b931d783afce52053c5',
          args: [
            '0x4082e997Ec720A4894EFec53b0d9AabfeeA44cBE',
            '0x114B697750CE6efd7D935F019d2460984Bc76942',
            '1'
          ],
          params: {
            from: '0x4082e997Ec720A4894EFec53b0d9AabfeeA44cBE',
            token: '0x114B697750CE6efd7D935F019d2460984Bc76942',
            amount: '1'
          }
        }
      ]
    }
  }

  exports.handler({ apiKey, apiSecret, request })
    .then(() => process.exit(0))
    .catch(error => { console.error(error); process.exit(1); });
}

```

---

<div class="post-metadata">

**Author:** ![DirtyCajunRice](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dirtycajunrice/32/15491_2.png) [@DirtyCajunRice](https://forum.openzeppelin.com/u/DirtyCajunRice)\
**Post date:** [June 27, 2022, 2:09am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/2 "2022-06-27T02:09:31Z")

</div>

Upon much longer inspection... the function is working perfectly... but the UI shows the BigNumber error from something else... maybe the return value?

---

<div class="post-metadata">

**Author:** ![zeljko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/zeljko/32/14206_2.png) [@zeljko](https://forum.openzeppelin.com/u/zeljko)\
**Post date:** [June 27, 2022, 11:53am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/3 "2022-06-27T11:53:21Z")

</div>

@DirtyCajunRice

Welcome to the community!

Thanks for reaching out and sorry for the inconvenience!

Thanks for detailed steps.

Just to confirm this error happens when you visit Autotask Run page to check execution result/logs or when you visit specific relayer page?

Best Regards,  
Zeljko

---

<div class="post-metadata">

**Author:** ![DirtyCajunRice](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dirtycajunrice/32/15491_2.png) [@DirtyCajunRice](https://forum.openzeppelin.com/u/DirtyCajunRice)\
**Post date:** [June 27, 2022, 1:31pm UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/4 "2022-06-27T13:31:34Z")

</div>

It is when looking at the run logs. They are all showing error with the error message above, but the entire process worked… so the only thing i can think of is there is some return value dying at the end messing up the UI? Its not the end of the world, but it makes it kinda hard to know when there actually is an issue haha

---

<div class="post-metadata">

**Author:** ![shrimalmadhur](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/shrimalmadhur/32/15497_2.png) [@shrimalmadhur](https://forum.openzeppelin.com/u/shrimalmadhur)\
**Post date:** [June 28, 2022, 4:28am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/5 "2022-06-28T04:28:55Z")

</div>

@zeljko I am also getting a very similar error. My transaction succeeds and I can see my smart contract upgraded but Autotask gives me an error. I am using relayer for gasless tx.

The logs says

```auto
2022-06-27T04:55:12.108Z	INFO	Relaying {
  from: '0xd99cBeb2f62935Ef3e451Aaf8Bf669e6474De46D',
  to: '0x6a5c9776d259f76aa445fc4FCC0cF14843f3DE74',
  value: '0',
  gas: '614468',
  nonce: '2',
  data: '0x296f4e16000000000000000000000000f4757e6b3f6abb71c52f494151e82307f6cec2f100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000062b9381f00000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000014d1120d7b16000000000000000000000000000000000000000000000000000014d1120d7b1600000000000000000000000000000000000000000000000000000000000000000000'
}

```

```auto
ERROR	Invoke Error {"errorType":"Error","errorMessage":"invalid BigNumber value (argument=\"value\", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2)","code":"INVALID_ARGUMENT","reason":"invalid BigNumber value","argument":"value","stack":["Error: invalid BigNumber value (argument=\"value\", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2)

```

If you see the value is `0` in the relayer transaction.

I am curious to know if I am doing something wrong?

---

<div class="post-metadata">

**Author:** ![zeljko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/zeljko/32/14206_2.png) [@zeljko](https://forum.openzeppelin.com/u/zeljko)\
**Post date:** [June 28, 2022, 9:28am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/6 "2022-06-28T09:28:53Z")

</div>

@DirtyCajunRice

Seems like that underlying problem is when Relayer with EIP1559 policy is used with `DefenderRelaySigner`.

Until this is resolved quick fix is to set Relayer policies to use legacy transactions(uncheck "Send EIP1559 Transactions by default" policy).  
Please let me know if this helps.

Best,  
Zeljko

---

<div class="post-metadata">

**Author:** ![zeljko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/zeljko/32/14206_2.png) [@zeljko](https://forum.openzeppelin.com/u/zeljko)\
**Post date:** [June 28, 2022, 9:36am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/7 "2022-06-28T09:36:45Z")

</div>

@shrimalmadhur

Thanks for reporting issues.

Are you using `DefenderRelaySigner` that is connected with Relayer that is sending EIP1559 transactions? This can be found by visiting the relayer page and checking Policies.

If that's the case then the problem is the same as reported by @DirtyCajunRice.  
Quick fix is to uncheck "Send EIP1559 Transactions by default" policy.  
We are working on a solution for this issue.

Best,  
Zeljko

---

<div class="post-metadata">

**Author:** ![shrimalmadhur](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/shrimalmadhur/32/15497_2.png) [@shrimalmadhur](https://forum.openzeppelin.com/u/shrimalmadhur)\
**Post date:** [June 29, 2022, 2:55am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/8 "2022-06-29T02:55:07Z")

</div>

@zeljko that did it. Thanks. Really appreciate your help. Is there any timeline for supporting the EIP 1559 by default case?

---

<div class="post-metadata">

**Author:** ![zeljko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/zeljko/32/14206_2.png) [@zeljko](https://forum.openzeppelin.com/u/zeljko)\
**Post date:** [June 29, 2022, 6:50am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/9 "2022-06-29T06:50:56Z")

</div>

@shrimalmadhur  
We are targeting this week to support them within Autotasks by releasing updated Autotask dependencies that would include `defender-relay-client` version 1.25.0.

I will notify you when this is pushed. We are targeting Thursday/Friday.

Best,  
Zeljko

---

<div class="post-metadata">

**Author:** ![zeljko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/zeljko/32/14206_2.png) [@zeljko](https://forum.openzeppelin.com/u/zeljko)\
**Post date:** [July 1, 2022, 6:45am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/10 "2022-07-01T06:45:13Z")

</div>

@DirtyCajunRice @shrimalmadhur

Just to inform you that we have released a new version of Defender that includes the latest version of `defender-relay-client` as an autotask dependency.

This enables usage of relayer with EIP1559 policy within autotasks.

In order to make this work you would need to recreate autotasks(create new ones with needed logic).

Note: We are working on a solution for upgrading autotask dependencies without recreating them.

Best,  
Zeljko

---

<div class="post-metadata">

**Author:** ![DirtyCajunRice](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dirtycajunrice/32/15491_2.png) [@DirtyCajunRice](https://forum.openzeppelin.com/u/DirtyCajunRice)\
**Post date:** [July 2, 2022, 11:24am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/11 "2022-07-02T11:24:57Z")

</div>

It eventually just stopped doing it ironically. I am glad that it brought up an edge case for yall though!

Thank you for the help 🙂

---

<div class="post-metadata">

**Author:** ![afozbek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/afozbek/32/20920_2.png) [@afozbek](https://forum.openzeppelin.com/u/afozbek)\
**Post date:** [May 9, 2024, 11:06am UTC](https://forum.openzeppelin.com/t/value-undefined-only-in-autotask/29957/12 "2024-05-09T11:06:01Z")

</div>

I know this thread is old, but right now I am getting same error discussed here when I try to call webhook url

I was running on the client side like this

```
const request = {
        from,
        data,
        to,
        value: 0,
        gas: 1e6,
        nonce: "0"
      };

const signature = await provider.send(method, [from, argData]);

const afterSignature = { ...request, signature };

 const fetchRequest = await fetch(url, {
    method: "POST",
    body: JSON.stringify({ request: afterSignature, signature }),
    headers: { "Content-Type": "application/json" }
  });

  const response = await fetchRequest.json();
  console.log({ response });

```

Autotask response message  
message  
**"invalid BigNumber value (argument="value", value=undefined, code=INVALID\_ARGUMENT, version=bignumber/5.7.0)"**

The checkbox @zeljko suggested not exist on dashboard anywhere. So I couldnt uncheck it and try it.  
Also we are trying to relay txs on Mantle blockchain.

I can share further information if you have but any help really appreciated.

Thanks!
