Open DanMotataeanu opened 3 years ago
Looks like network requests are failing across multiple SDKs (Crashlytics, Analytics, Firestore) with either network connection lost or request timeout errors. Are you able to reproduce this on every network (for example LTE and different wifi networks)?
Yes, it happened on both wifi and LTE. The simulator is working fine, but tested it with 2 phones, both iOS 14 beta 4 and looks like it is not working.
This is unlikely to make a difference, but are the connection issues reproducible with Firebase 6.29?
target 'Clip' do
use_frameworks!
platform :ios, '14.0'
pod 'Kingfisher/SwiftUI'
pod 'Firebase/Crashlytics'
pod 'FirebaseFirestoreSwift'
pod 'Firebase/Analytics'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
end
This is my current podfile, how can I change Firebase version if I'm importing just the parts I need?
Do pod update
Did it, many packages got updated, but it is still not working.
@DanMotataeanu if you create a blank project and set up App Clips and use Firestore (same project is fine) - do you run into the same issue?
Creating a new project, setup an app clip for it and trying to integrate Firebase services it doesn't even get past the phase where Firebase is waiting for a connection.
Hi @DanMotataeanu - I was unable to reproduce the issue in a blank App Clip project.
Steps I tried:
pod init
Firebase/Firestore
to the Podfile. Ran into an unrelated issue (#4889) but fixed it with use_frameworks! :linkage => :static
in the App Clip target.GoogleService-Info.plist
file to project.FirebaseApp.configure()
to AppDelegate.swift
onAppear
SwiftUI view, similar to your code snippet.If you do have a new project that does reproduce the issue, please share it with us (without a GoogleService-Info.plist) and we can make further progress but without a reproduction we won't be able to get very far.
Thanks for helping me out!
At this moment I have this very simple code which triggers the error.
struct ContentView: View {
var body: some View {
Text("Hello, world!")
.padding().onAppear{
Firestore.firestore().collection("locations").getDocuments{ (docs, err) in
if let err = err {
print(err.localizedDescription)
}
else {
for doc in docs!.documents {
print(doc.documentID)
}
}
}
}
}
}
FirebaseApp.configure()
called in in AppDelegate.swift
as you did.
The issue does not reproduce on simulator, only on a real device - both LTE and WiFi.
If you still can't reproduce it, I might also try a factory reset of the phone to see if that helps.
Aha! Apologies for not noticing the simulator vs device comment you had previously mentioned.
Good news and bad news: good news is I was able to reproduce! Bad news is that it looks like a real issue, I'll start digging into what's going on now.
Thank you very much again for reporting this 👍
While digging into this issue, we've turned up this note: https://developer.apple.com/forums/thread/652104.
Firestore uses gRPC which uses CFStream for network access. This is being denied by the OS. Unfortunately this means there's no short term fix possible for this--we'd need to either migrate gRPC to NSURLSession or reimplement the subset we need for ourselves, neither of which are small projects.
For the foreseeable future this means that the Firestore SDK is not compatible with App Clips. To access Firestore data you'll need to use the REST API via NSURLSession.
Whoa, quite bad news this time.
While calls for fetching documents from the database could be replaced by httpsCallable
cloud functions, the real time listeners don't really have any alternative.
For the foreseeable future this means that the Firestore SDK is not compatible with App Clips
This means that even after launching the App Clips (hopefully fall 2020) Firebase compatibility isn't 100% sure?
As a side note, my other issue might have the same root cause?
Whoa, quite bad news this time.
While calls for fetching documents from the database could be replaced by
httpsCallable
cloud functions, the real time listeners don't really have any alternative.
Fetching documents can be done directly against the Firestore REST API without needing to stand up a cloud function (background, reference). You're right that the major limitation here is that listens are not available in the REST API.
For the foreseeable future this means that the Firestore SDK is not compatible with App Clips
This means that even after launching the App Clips (hopefully fall 2020) Firebase compatibility isn't 100% sure?
At this point we can't commit to this working when App Clips launch. I won't say it's impossible, but you should definitely plan for Firestore to be incompatible with App Clips.
As a side note, my other issue might have the same root cause?
I can't speak with any authority on that topic. From what I can see the error contains an _NSURLErrorFailingURLSessionTaskErrorKey
which seems to indicate that this is using NSURLSession but failing anyway. This seems like a different issue.
This is also the exact same issue with FirebaseDatabase.
@StephanWalters yes, unfortunately Firebase Database is affected by the same issue.
On the technical level, the hurdles to get Database running are going to be easier since it's not migrating gRPC but migrating from SocketRocket (which is an overall smaller dependency) and the surface area of APIs that touch SocketRocket is relatively small. That being said, it's still replacing the entire networking stack of the SDK and that requires extensive testing and careful consideration, so it likely won't arrive in time for the public release but we're investigating it.
I momentarily used this ver dirty workaround https://gist.github.com/YannisDC/2ff574a127ab1401b01e10eb69d53f08 using it in a repository as such https://gist.github.com/YannisDC/35bc907e667633e0ad0179b54b107af6 for those that want a temporary workaround.
@YannisDC I am doing something similar using IK Event Source for server side events, to simulate firebase's real time listenrs:
I found, when i turn on my iPhone Settings
-> Developer
-> HTTP/3
and use firebase, this will happen.
Turn off HTTP/3
then no these logs.
Hi, are there any updates as to if or when this issue will be fixed? Trying to integrate Firestore with an App Clip here, thanks!
There probably won’t be any fix. App clips don’t allow socket connections (CFSocket) on physical devices. Your best bet will be to use Firebase Functions and use your Firestore code in that.
On Tue, Nov 17, 2020 at 9:54 PM William Bai notifications@github.com wrote:
Hi, are there any updates as to if or when this issue will be fixed? Trying to integrate Firestore with an App Clip here, thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-ios-sdk/issues/6211#issuecomment-729343152, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7B63D72Q3PR4NI5H7OY6TSQMZNBANCNFSM4PVPJGIA .
There's no "fix" to make. We're working with the gRPC team to build an alternative implementation that is compatible with App Clips (and also watchOS). This is a major undertaking and we can't promise it will even necessarily work or when it will be released.
If you're building an App Clip today and want access to Firestore data, you'll need to access the data using means other than this SDK, as described above.
Even though this was reported as a bug, the best way to think of this is as a feature request to support App Clips. We're leaving it open on that basis.
Not sure if this info helps or not but I'm trying to upload a file to Firebase Storage in an AppClip. When I do fileRef.putData() for a small text file, all work fine. When I do fileRef.putFile(), I'm getting "unknown error". From the error message and other log entries, it looks like it's related to this:
https://developer.apple.com/forums/thread/669148
Basically, that guy says, you can't use background session in an appclip. My best guess is that putFile() uses background session while putFile doesn't. Didn't look into the sources though.
I momentarily used this ver dirty workaround https://gist.github.com/YannisDC/2ff574a127ab1401b01e10eb69d53f08 using it in a repository as such https://gist.github.com/YannisDC/35bc907e667633e0ad0179b54b107af6 for those that want a temporary workaround.
@YannisDC does this work the same way a listener works, or do you have to manually poll for data?
Hello Everybody, @ryanwilson
Are there any updates here? I am facing a similar problem with the app clip, and I'd like to know if there are any updates.
Thanks!
We're working with the gRPC team to build an alternative implementation that is compatible with App Clips (and also watchOS).
Is there a GitHub issue tracking this effort?
We're working with the gRPC team to build an alternative implementation that is compatible with App Clips (and also watchOS).
Is there a GitHub issue tracking this effort?
^
I just tried saving a document and fetching it from Firestore in an AppClip and it works as expected. I've not tested real time updates, but my use case doesn't require that. Just fetching and saving is good enough for me.
FYI, To access same Firestore from both main app and app clip targets, you need to add two iOS apps in your Firebase console with the bundle identifiers of main app and app clip.
By the way, I also tested Firebase functions from the AppClip and that worked as expected as well.
@imthath-m was this on a real device? If so, which iOS version? If it's in the simulator, note that the networking stack used by the simulator is not the same as on device, where the simulator worked and the device didn't last time I checked.
Sorry folks, I don't have any other updates around this. The REST endpoint is still the best way to access Firestore data from an App Clip.
@ryanwilson Thanks for the pointer. Indeed, I tested in Simulator and it is not working in physical device.
However, I tried callable firebase functions from App Clips in physical device (iOS 16.7) and they work as expected. I assume they don't need require socket connections to work (even though some libraries are added). I might go with callable functions instead of REST endpoints.
Callable functions use HTTPS. In fact, callable functions are a thin wrapper around HTTPS functions, the main benefits being they automatically carry the authentication context, and make it easier to send and receive Codable
data.
[REQUIRED] Step 1: Describe your environment
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
What happened? How can we make the problem occur? The problem happens when you build an app clip using iOS 14 beta 4. Basically, you can not fetch any data from Firestore.
Relevant Code:
The problem was not here in iOS Beta 3 and Auth for example is working well and generates an anonymous token everytime.