0

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

1 Answers1

0

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.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 26 '23 at 20:50