Defender-relay-client

I am using web3-react on my machine
I have installed defender-relay-client
like shown in the instructions

const {
  DefenderRelayProvider,
  DefenderRelaySigner,
} = require("defender-relay-client/lib/ethers");

const credentials = {
  apiKey: process.env.API_KEY,
  apiSecret: process.env.API_SECRET,
};```

then calling it

however this error apprears:

TypeError: Cannot set property crypto of #<Window> which has only a getter

defender-relay-client isn't designed to run in browser environments, only in node runtimes. If you are working in a pure frontend app, consider creating an autotask and moving this code there. Set up the autotask to be triggered via webhooks. Then in your browser code post to the webhook instead.

Hope this helps,
Martin

I will try thank you, for your fast answer

Thank you it is working.
however I am facing two other issues based on the relayers options
gas limit and whitelisted accounts.
Do you have an example of an autotask script calling both options, I think my issue is coming from there, I didn't find anything on the web
Thank you for your time

This is my code

const ABI = [`function claim() public`];
const ADDRESS = "0x42165d2e41eccc424A27A75C059F2887daF49739";

const { ethers } = require("ethers");
const {
  DefenderRelaySigner,
  DefenderRelayProvider,
} = require("defender-relay-client/lib/ethers");

exports.handler = async function(event) {
  // Initialize defender relayer provider and signer
  const provider = new DefenderRelayProvider(event);
  const signer = new DefenderRelaySigner(event, provider, { speed: 'fast' });

  // Create contract instance from the signer and use it to send a tx
  const contract = new ethers.Contract(ADDRESS, ABI, signer);
  if (await contract.claim()) {
    const tx = await contract.claim();
    console.log(`Called execute in ${tx.hash}`);
    return { tx: tx.hash };
  }
}