Getting request timed out when making an Http call from Firebase Functions

Hello, I’m making a direct Http call to Firebase Functions from iOS, which in turns makes an Http call to Infura’s IPFS gateway, but I’m getting a request time out error.

const ipfsClient = require("ipfs-http-client");
const functions = require("firebase-functions");

const runtimeOpts = {
    timeoutSeconds: 500,
    memory: "1GB",
};

const ipfs = ipfsClient({
    host: "ipfs.infura.io",
    port: 5001,
    protocol: "https",
});

exports.add = functions
    .runWith(runtimeOpts)
    .https
    .onRequest((req, res) => {
    ipfs.add(buffer.data, (error, result) => {
        functions.logger.log("result", result);

        if (error) {
            functions.logger.log("error", error);
            return res.status(500).send({"error message": error});
        }
        return res.status(200).send({"result": result});
    });
});

I’ve changed the timeout settings of Firebase Functions, but still get the following message:

Task <432A07C-EE0C-4323F-A6B7-E04C3E2931F2>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 “The request timed out.” UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x600001bd5020 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 “(null)” UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <432A07C-EE0C-4323F-A6B7-E04C3E2931F2>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(“LocalDataTask <432A07C-EE0C-4323F-A6B7-E04C3E2931F2>.<1>”), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://cloudaddress.cloudfunctions.net/add, NSErrorFailingURLKey=https://cloudaddress.cloudfunctions.net/add, _kCFStreamErrorDomainKey=4}

Hi @Kevin Welcome to the Infura community.
This doesn’t seem like an Infura IPFS error.
Check out this thread