firebase-ios-sdk: 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([ ...
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (10 by maintainers)
The “http” prefix should not be required in useEmulator, that’s a bug. So I’ll fix that which means that the workaround presented in this Issue will break in the future (just FYI)
Potential duplicate: https://github.com/firebase/firebase-ios-sdk/issues/7538
@ir-fuel @peterfriese A couple changes I had to do to make emulator working for me:
Please let me know if these changes are sufficient for you as well.
@ir-fuel Let me try it on my end and get back to you.