IPFS CORS error

Hey! I’m still not able to run any of the example code here - seeing null responses or 400 errors. Could you post the workaround code that is supposed to be working? Also, what is YOUR_AUTH_KEY? Is it the concatenation of my project ID and secret?

Hey @andrew - the YOUR_AUTH_KEY should be the project ID :slight_smile:

We are close to being able to release an update that should fix this issue. Thank you all for your continued patience as we worked through this to figure out what was going on and how to properly fix it. I will be sure to update this post once the fix is live.

2 Likes

Any updates or workarounds on this issue? Getting a 400 error on the fetch approach and CORS issues with ipfs-http-client.

I was really happy to find out this kind of security options in the Infura IPFS console but after testing and seeing this thread I was very disappointed that it just don’t work out of the box :woman_shrugging:.
So I ended up running my own IPFS with working CORS filters as I couldn’t wait for the fix.

May I know what’s the ETA for this fix?

@Leiya_Kenney hello, do we have an ETA for a fix on this. I’m getting my butt kicked over here. Hope you can help or give an update. Thanks!

Hi all (@ti0, @festbot, @Crypto.Joe, @Theodore_Michels, @debokarmakar1994, @garygeorge, @eugen, @mightymatth, @andrew, @amilich, @newbyca, @raresserban96, @mark008000e, @charlowspam, @Matthew_Piper, @agraignic, @kelok, @_dc) -

We have released a fix for this issue, and everything should be working as expected now. Please let us know if you encounter any additional issues.

Hi @Leiya_Kenney,
Seems like I’m experiencing the same issue described above today?

Access to XMLHttpRequest at 'https://rinkeby.infura.io/v3/3c0b20...' from origin 'https://sparkwave.xyz' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Can you help?

I am having the same issue as @Matteo_Mosca

Hi @Matteo_Mosca and @odds we have an ongoing incident, please follow the progress here: Infura Status - ETH1, Palm, Optimism, Polygon, Filecoin, and Arbitrum API outage

Hello! I’m still getting a 400 error with the fetch API.

    const body = new FormData();
body.append('file', new Blob([JSON.stringify(metadata, null, 2)], { type: 'application/json' }), 'metadata.json');

try {
  const response: Response = await fetch('https://ipfs.infura.io:5001/api/v0/add?progress=true', {
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data',
      Authorization: `Basic ${infuraId}`,
    },
    mode: 'no-cors',
    body: body,
  });

  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
  const json = await response.json();
  console.log(json);
} catch (error) {
  console.error(error);
  toast.custom(<Alert type={AlertType.ERROR} message={String(error)} />);
}

POST https://ipfs.infura.io:5001/api/v0/add?progress=true 400 (Bad Request)

And when I use my dedicated gateway subdomain I get: net::ERR_CERT_COMMON_NAME_INVALID

there is no solution to the problem so far
Leiya_Kenney, could you please provide a solution or tell me where it was posted? Thank you

can you tell me where to find this solution, because you say you have already brought it out, but where is it?

const auth = Basic ${Buffer.from(${projectId}:${projectSecret}).toString('base64')};

const client = ipfsHttpClient({

host: ‘infura-ipfs.io’,

port: 5001,

protocol: ‘https’,

headers: {

authorization: auth,

},

mode: ‘no-cors’,

body: data,

});

it’s showing errors as
Access to XMLHttpRequest at
https://infura-ipfs.io/ipfs/QmeLAJNCw823gmJtdQP3S3Yt4FeJEUP1Y4yP6g42WKk9Yp’ from origin htp://localhost:300’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Hi @shashwatwankhedekar,

wellcome!

Do you have your complete code available for us to look at, say in github?

I can see a number of problems with this line:

const auth = Basic ${Buffer.from(${projectId}:${projectSecret}).toString('base64')};

but it may be due to copy/paste corruption.

There is an example here that might help you, please let us know if it helps or if you have other questions.

Warm regards,
Chris | Infura | ConsenSys

Hi everyone.I’m getting the following error:

Following INFURA docs, I defined the client.

const projectId = ...;
const projectSecretKey = ...;
const auth = `Basic ${Buffer.from(`${projectId}:${projectSecretKey}`).toString("base64")}`;
const subdomain = ...;

const client = ipfsHttpClient({
    host: "infura-ipfs.io",
    port: 5001,
    protocol: "https",
    headers: {
        authorization: auth,
    },
});

I have not issue in uploading, posting information and getting the related URL. The CORS error comes up when I’m trying to fetch information from the URL. Specifically, in the following line:

const data = await axios.get(tokenURI);

Where the tokenURI is the URL created. Any solution? Thanks.

P.S. Using the Moesif CORS extension everything works fine, but I would like a permanent solution.

A post was split to a new topic: Request without auth header?