Skip to main content
2 of 2
Updating the answer to include additional details

I don't see anything, it should work, maybe router address is incorrect IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) or maybe transaction value is not enough to buy amountOutMin or that token does not have Pool or Liquidity Provider

Make sure you're using the right RPC. Change the Environment to InjectedWeb3Provider and Set Your Infura RPC in the window