Calling Cloud Functions locally from iOS gives an “Insecure fetch request” error

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 12.4
  • Firebase SDK version: 7.6.0
  • Installation method: Swift Package Manager
  • Firebase Component: Functions

[REQUIRED] Step 2: Describe the problem

When running the emulator locally and calling a HTTPS function, the console outputs the following message:

 Insecure fetch request has a scheme (localhost) not found in fetcher allowedInsecureSchemes ((
    http
)): localhost:5001/****/us-central1/testFunction

Steps to reproduce:

Create a cloud function:

Run the emulator locally

Setup the iOS app to call your function and call it

Relevant Code:

exports.testFunction = functions.https.onCall(async (data, context) => {
}
firebase emulators:start

on iOS:

            let functions = Functions.functions()
            functions.useEmulator(withHost: "localhost", port: 5001)

            functions.httpsCallable("testFunction").call([ ...

1 possible answer(s) on “Calling Cloud Functions locally from iOS gives an “Insecure fetch request” error