How to set gasLimit when deploying an upgradeable contract?

I am trying to use hardhat-upgrades plugin to deploy an upgradeable contract. I think because my contract is right at the bytecode size limit, when I try to deploy it, it was failed with error: unable to estimate gas, try setting manual gas limit.

Where can I set the gas limit when deploying an upgradeable contract? I tried to set gas limit on hardhat.config.ts by setting "gas", but the error still exists. Is there a way to set the gasLimit like {gasLimit : "500000"} when calling a contract's method?

Sorry we don't have a way to set the gas limit for deployment right now.

I would've expected setting "gas" in the Hardhat config should work, but perhaps Ethers.js is ignoring that and trying to estimate it anyway.

You can subscribe to this issue for the feature: