CORS not working with function apps calling IPFS

Kallol Borah 0 Reputation points
2023-06-08T07:36:22.9233333+00:00

Hello

We are trying to use a function app to set / get data from IPFS. The CORS is allowed on https://ipfs.infura.io:5001 and following is the code snippet

const auth = 'Basic ' + Buffer.from(REACT_APP_projectId + ':' + REACT_APP_projectSecret).toString('base64');
// Create an IPFS client instance
const client = ipfsClient.create({ host: "ipfs.infura.io",
port: 5001,
protocol: "https",
headers: {
authorization: auth,
}
});
const ipfsCIDIndentity = (await client.add(encodedIdentity)).path;

However, for some reason, the IPFS call does not go through.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-06-08T15:15:56.2433333+00:00

    Kallol Borah Thanks for posting your question in Microsoft Q&A. Have you enabled CORS for your Function App? I suggest you review Cross-origin resource sharing doc and enable CORS for the Function app.

    If it is already enabled and still face the issue, share more info about the request/response from the logs or App Insights. That would help in understanding the issue and assist you better.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.