Hardhat-upgrades attempts to verify non-beacon contract as beacon

Repost after my previous post was flagged as spam:

Our PluginSetup contracts having an implementation function, e.g., this one

are falsely recognized as beacon contracts when attempting to verify them while using the hardhat-upgrades package.

Executing the command

npx hardhat --network goerli verify 0xe50953d06215420276D147dce9C6986C518968D5

in the project's root folder results in the following error

Verifying implementation: 0x0fd06dA1E84090B15C3BE23eA134E87e248e2335
The contract 0x0fd06dA1E84090B15C3BE23eA134E87e248e2335 has already been verified
Verifying beacon: 0xe50953d06215420276D147dce9C6986C518968D5
An unexpected error occurred:

Error: Could not find an event with any of the following topics in the logs for address 0xe50953d06215420276D147dce9C6986C518968D5: OwnershipTransferred(address,address)

If the proxy was recently deployed, the transaction may not be available on Etherscan yet. Try running the verify task again after waiting a few blocks.

When commenting out the import '@openzeppelin/hardhat-upgrades'; statement from the hardhat.config.ts, it works.

Is there an option to run the verification task without beacon detection or some other way to solve this issue?

Thank you in advance.

A similar question was asked in Unverified ERC1967 Proxy goerli

This is the environment I was using:

:computer: Environment

Solidity: 0.8.17

NPM Package versions:

"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@openzeppelin/contracts": "^4.8.2",
"@openzeppelin/contracts-upgradeable": "^4.8.2",
"@openzeppelin/hardhat-upgrades": "^1.21.0"

As also suggested in this issue https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/752, I think a fallback to the regular hardhat verify task is the right solution here.

Thanks for raising this, I agree and will look into addressing this through that issue.