[ISSUE]: token_uri is different then expected

Hi, I have a problem regarding token_uri. I updated my contract to rewrite token_uri to use this as base https://gateway.moralisipfs.com/ipfs/ , but every time I create an NFT now it is returning https://ipfs.moralis.io:2053/ipfs/ . It worked for a while and now all of a sudden not anymore. When testing the function with remix it returns the correct URL but not when calling moralis getNFTs. Can someone help me why is this? This is the code in question.

pragma solidity ^0.8.12;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";

contract NFT is ERC1155 {

    constructor() ERC1155("https://gateway.moralisipfs.com/ipfs/") {}

     * @notice Override ERC1155 base uri function to use IPFS CIDs instead of token ids
     * @param id ID of token to get URI for
     * @return Correctly formatted IPFS URI for token
    function uri(uint256 id) public view virtual override returns (string memory) {
        return string(abi.encodePacked(super.uri(id), lookupmap[id]));

You can try to resync the uri for that token id.

As an idea, what moralis returns as token_uri for IPFS is not always the uri from the smart contract, for example if the token_uri is a generic ipfs uri then it adds that https://ipfs.moralis.io:2053/ipfs/ prefix.

What do you mean by generic IPFS uri? Does that mean it could prefix the pinata IPFS uri with moralis URI as well?

Is there a way to request contract token_uri?

Tried resyncing token multiple times, but still not getting the result I am hoping for.

by generic IPFS uri I mean something like ipfs://QmQzwoufy8YRzk2KxuW8w8pKRoQcUjXA1YMR8GyYAv5DPK
you can have something like this in your contract as token uri.

for resync you have to use uri flag, not sure if it will make a change.

You can use runContractFunction for example to get the token_uri directly from chain for a contract and token_id.

What is the problem that you have now with current token_uri?

CORS issue when loading the token_uri.

Access to XMLHttpRequest at 'https://ipfs.moralis.io:2053/ipfs/QmNWvX6Hega6JoLotiSeymis3VU61D4pdk4ZrqWFZ3UujT' from origin 'https://mydomain.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Resynced the token with flag: uri but it did not work.

if you change from
by doing a replace on that prefix before accessing it, then it works?

Yes and we did that to resolve the issue. I would prefer not to, but actually get the token_uri it is connected to the contract in getNFTs and we dont want to call the contract function for every NFT because it is in the list and would slow down the app.

Why does moralis prefix the token_uri with https://ipfs.moralis.io:2053 even if the URI is not a generic URI?

This is the data we get when we call the ERC1155 uri contract function https://gateway.moralisipfs.com/ipfs/.... As we can see it is prefixed with moralis gateway. Why is it changed then?

I don’t know exactly, we did some changes last few days.

You can replace that prefix and use any other public IPFS gateway.

Is there a changelog that we can view to track all the changes and modify our code accordingly depending on moralis API changes?

we don’t have a change log at this moment

Ok. Could we assume that this might be a bug then, that moralis is overwritting the token_uri prefix?