We are trying to implement gasless mint through openzepplin defender and infura API.
If it ran at local, it would work fine. But if it ran at AWS lambda, it does not work now.
Through my investigating, this request(HTTPSProvider.getTransactionCount) can not get any responces.
import {
Contract,
providers,
Wallet,
Signer,
BigNumberish,
BytesLike
} from 'ethers';
import Web3 from 'web3';
import { AccessController, contracts } from './typechain-types';
import '@ethersproject/shims';
export const web3: Web3 = new Web3(
new Web3.providers.HttpProvider(process.env.NODE_URL || '')
);
export const HTTPSProvider = new providers.JsonRpcProvider(
process.env.NODE_URL || ''
);
const nonce: BigNumberish = await HTTPSProvider.getTransactionCount(
await wallet.getAddress()
);
NODE_URL is here
https://polygon-mainnet.infura.io/v3/xxxxxxxxdddddddggggg
Does anyone know this reason?
gasless mint works fine at lambda
I could resolve. The reason why Lambda can not access external URL over the internet under default setting. I put a subnet with nat gateway.