.executeFunction(opts) not working in particular case

Hi im having a hard time invoking my setURI function from the front end. It works when I manually do it on remix. If anyone can help me figure this out much apreciated. In the console log you can see the token id and tokeURI values
Below is my hook handling the front end call and also the function from the smart contract.

import  {useMoralis} from "react-moralis"
import Mint_A_Gram from ".././abi/Mint_A_Gram.json";
import { useState } from "react";
import { Uint256 } from "soltypes";
export const useSetTokenUri = (contractAddress: string, tokenId: Uint256, tokenURI: string) => {
  const {Moralis} = useMoralis()
  const[tokenUriState, setTokenUriState] = useState<any>({status: "waiting for tokenURI"})
  const {abi} = Mint_A_Gram;
  const handleSetTokenUri = async () => {

    console.log(tokenId)
    console.log(tokenURI)

    setTokenUriState({status: "setting your token URI"})
    const opts = {
      chain: "rinkeby",
      contractAddress: contractAddress,
      functionName: "setTokenURI",
      params: {tokenId,tokenURI},
      abi: abi,
      msgValue: "2"  
    }

    const setTokenUri = await (Moralis as any).executeFunction(opts)
    .then( (res: { data: any; }) => {
      console.log(res)
    }).catch((error: any) => {
      console.log("error ->  ", error)
    });

    if(setTokenUri != null || undefined)
    setTokenUriState({status: tokenUriState.status.value})
  }
return {handleSetTokenUri, tokenUriState}
}
function uri(uint256 tokenId) override public view returns(string memory){
        return(x_uris[tokenId]);
    }
function setTokenURI(uint256 tokenId, string memory uri) public {
       require(bytes(x_uris[tokenId]).length == 0, "uri can only be set once.");
        x_uris[tokenId] = uri;
    }

It sudenly started working lol I don’t think I changed anything. Maybe it was a issue with the testnet? Sometimes it says gas estimation error others it works

what RPC node address did you use in metamask? a speedy node from Moralis or something else?

I dind’t have the function set as payable lol noob mistake. But makes me wonder why it worked a few times b4 i changed that haha