i'm following the Relay Gasless tutorial and i'm getting an error in the moment to run yarn relay.
Error: API key and secret are required
but, the api key and secret are filled normally
const client = new Defender(creds);
async function handler(event) {
// Parse webhook payload
if (!event.request || !event.request.body) throw new Error(Missing payload
);
const { request, signature } = event.request.body;
console.log(Relaying
, request);
// Initialize Relayer provider and signer, and forwarder contract
const creds = { ... event };
const client = new Defender(creds);
const provider = client.relaySigner.getProvider();
const signer = client.relaySigner.getSigner(provider, { speed: 'fast' });
const forwarder = new ethers.Contract(ForwarderAddress, ForwarderAbi, signer);
// Relay transaction!
const tx = await relay(forwarder, request, signature);
console.log(Sent meta-tx: ${tx.hash}
);
return { txHash: tx.hash };
}
const { handler } = require('../action/index.js')
// Run autotask code locally using the Relayer API key and secret
if (require.main === module) {
require('dotenv').config()
const { RELAYER_API_KEY: apiKey, RELAYER_API_SECRET: apiSecret } = process.env
const payload = require('fs').readFileSync('tmp/request.json')
handler({ apiKey, apiSecret , request: { body: JSON.parse(payload) } })
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
}