You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the default ports for setting up the emulators
Implement a simple callable helloWorld function (see below)
Launch the emulators (firebase emulators:start)
Create a new (SwiftUI) project
Download GoogleService-Info.plist and add to project
Enable App Transport Security (allow arbitrary loads)
Initialise the emulators (see Swift code below)
Call helloWorld callable function from Swift (see code below)
Expected behaviour
It is possible to call the helloWorld callable function from the iOS app
Observed behaviour
GTMSessionFetcher issues error message about http not being in list of allowed insecure schemes:
2021-02-16 16:32:29.570523+0100 FirebaseEmulatorDemo[47823:2419456] Insecure fetch request has a scheme (localhost) not found in fetcher allowedInsecureSchemes ((
http
)): localhost:5001/peterfriese-friction-emulators/us-central1/helloWorld
Error Domain=com.google.GTMSessionFetcher Code=-5 "(null)" UserInfo={NSErrorFailingURLStringKey=localhost:5001/peterfriese-friction-emulators/us-central1/helloWorld}
Relevant Code:
Callable Function:
exports.helloWorld=functions.https.onCall((data,context)=>{return{message: "Hello World from Firebase"};});
Swift code for initialising emulators and calling the Function
classFirebaseEmulatorDemo:ObservableObject{
lazy varfunctions=Functions.functions()init(){FirebaseApp.configure()
// set up emulators
Auth.auth().useEmulator(withHost:"localhost", port:9099)
functions.useEmulator(withHost:"localhost", port:5001)}func helloWorld(){lethelloWorld= functions.httpsCallable("helloWorld")
helloWorld.call(){ result, error in
if let error = error {print(error)}else{
if let message =(result?.data as?[String:Any])?["message"]as?String{print("The function returned: \(message)")}}}}}
Step 1: Describe your environment
Swift Package Manager
Step 2: Describe the problem
Steps to reproduce:
helloWorld
function (see below)firebase emulators:start
)GoogleService-Info.plist
and add to projectApp Transport Security
(allow arbitrary loads)helloWorld
callable function from Swift (see code below)Expected behaviour
helloWorld
callable function from the iOS appObserved behaviour
GTMSessionFetcher
issues error message abouthttp
not being in list of allowed insecure schemes:Relevant Code:
Callable Function:
Swift code for initialising emulators and calling the Function
Related material
firebase-ios-sdk/Functions/FirebaseFunctions/FIRFunctions.m
Lines 247 to 251 in 02488e9
The text was updated successfully, but these errors were encountered: