firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Functions chunky response

Open nmalevich opened this issue 9 months ago • 3 comments

Description

I write response by chunks. On my local server it works, but Firebase Function return response only after "res.end()"

exports.cloudFunctionEntryPoint = async (req, res) => {
    setTimeout(()=>{
        res.write("1\n");
    }, 1000)
    setTimeout(()=>{
        res.write("2\n");
    }, 2000)
    setTimeout(()=>{
        res.write("3\n");
    }, 3000)
    setTimeout(()=>{
        res.write("4\n");
    }, 4000)
    setTimeout(()=>{
        res.write("5\n");
        res.end();
    }, 5000)
}

Reproducing the issue

No response

Firebase SDK Version

10.25.0

Xcode Version

15.3

Installation Method

Swift Package Manager

Firebase Product(s)

Functions

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet

Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

nmalevich avatar May 08 '24 13:05 nmalevich

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar May 08 '24 13:05 google-oss-bot

Hi @nmalevich, could you provide a code snippet of your Firebase Functions and iOS code invoking the function so I could reproduce it on my end? Thanks.

rizafran avatar May 09 '24 18:05 rizafran

Thank you for your reply. My general question about having possibility to implement streaming data(sending response by chunks)

nmalevich avatar May 10 '24 11:05 nmalevich

@nmalevich, per checking, it looks like Cloud Functions does not support data streaming. They have a timeout limitation of up to max 10MB. You may refer to this post.

Closing this issue, but feel free to comment if you have any questions.

rizafran avatar May 28 '24 11:05 rizafran