Open h2u opened 6 years ago
Encountered the same error just yesterday when querying data. Seems to be a problem with Firestore not able to get data.
Environment Operating System version: Windows 10 Browser version: Chrome 68.0.3440.106 Firebase SDK version: 5.0.4 Firebase Product: store
Packages
"dependencies": {
"animated-number-vue": "^0.1.2",
"firebase": "^5.0.4",
"highcharts": "^6.1.0",
"mdi": "^2.2.43",
"raven-js": "^3.26.2",
"vue": "^2.5.16",
"vue-add-to-calendar": "^1.0.4",
"vue-fullscreen": "^2.1.3",
"vue-highcharts": "0.0.10",
"vue-infinite-scroll": "^2.0.2",
"vue-progressbar": "^0.7.5",
"vue-router": "^3.0.1",
"vue-swatches": "^1.0.1",
"vuefire": "^1.4.5",
"vuetify": "^1.0.17",
"xlsx": "^0.13.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.51",
"@babel/plugin-syntax-jsx": "^7.0.0-beta.51",
"@babel/plugin-transform-runtime": "^7.0.0-beta.51",
"@babel/preset-env": "^7.0.0-beta.51",
"@babel/preset-stage-2": "^7.0.0-beta.51",
"@vue/cli": "^3.0.0-rc.2",
"@vue/cli-init": "^3.0.0-rc.2",
"autoprefixer": "^8.3.0",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^8.0.0-beta.3",
"babel-plugin-transform-vue-jsx": "^4.0.1",
"chalk": "^2.4.1",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.11",
"file-loader": "^1.1.11",
"friendly-errors-webpack-plugin": "^1.7.0",
"html-webpack-plugin": "^3.2.0",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"mini-css-extract-plugin": "^0.4.0",
"node-less": "^1.0.0",
"node-notifier": "^5.2.1",
"optimize-css-assets-webpack-plugin": "^4.0.0",
"ora": "^2.0.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.5",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.2",
"semver": "^5.5.0",
"shelljs": "^0.8.1",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^1.0.1",
"vue-loader": "^15.0.3",
"vue-style-loader": "^4.1.0",
"vue-template-compiler": "^2.5.16",
"webpack": "^4.6.0",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.0.7",
"webpack-dev-server": "^3.1.3",
"webpack-merge": "^4.1.3"
},
+1
I think that anti-virus software is causing this error as one of the causes.
@h2u Is the problem random or occuring for each request ? We have a similar issue here for a similar setup (firestore 5.0.4, chrome), and this problem occurs randomly, blocking all requests after the first fail. Problem is happening in production for our users. the big difference with your stack is that we use firestore in a web browser context, not Ionic (even though it should be pretty similar).
I managed to find out that installing the Firebug Lite Chrome extension makes the problem appear almost immediately and consistently. The "XHR Listener" used by firebug (patching the XMLHttpRequest with a wrapper) is causing the issue. Unfortunately, out users/clients encounter the problem without Firebug Lite installed, so the root cause must be somewhere else.
Any help would be appreciated.
EDIT : In the meantime, we'll switch to the REST API.
@mickev36 , the problem is random but happens very recently.
Maybe @d-yoshi is right, it's anti-virus. Had no chance to work on project without anti-virus on Windows.
At the moment Im working on MacOS on the same network as Windows was and have no problems with connection.
In our case it was also the anti-virus (Kaspersky). It worked without it.
I feel that I have same problem because I have Kaspersky as well.
I'm also using Kaspersky and I encountered this problem frequently. I don't know any solution other than invalidating Kaspersky for now. 😢
I can confirm that this bug is very random, happened recently, and I don't have any antivirus software, except the default Windows Defender, which I can't turn off because of company policy.
Same problem here since a week or two. Also Kaspersky... When I first load the page the following error message is output (every single time):
@firebase/firestore: Firestore (5.5.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
after 30+ seconds the data from firestore finally loads
XHR finished loading: POST "https://firestore.googleapis.com/google.firestore.v1beta1.Firestore/Listen/channel..."
If I reload the page and navigate to another page, where firestore data is loaded, I immediately get the data back without the error. 😕
If I pause Kaspersky the error does not occurr.
...
"@angular/fire": "^5.0.0",
"firebase": "^5.5.0",
...
Same here. My users (in web browsers) get the same message about firestore not being able to reach its backend once Kaspersky is activated on a Win 10 machine...
Same for me but only on IE 11.
But if I load the page, navigate immediatly to another page and then return to "firestore page", data is loaded without the error.
In my case, it seems like it's a conflict with webcomponents.js because when I do not put it, it works
In my case it was due to Rn-fetch-blob library. I moved
const Blob = RNFetchBlob.polyfill.Blob
const fs = RNFetchBlob.fs
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
window.Blob = Blob
inside the async function rather then defining it at the top. And it solved.
+1
So I just generated a new angular project and only used the firebase sdk (5.5.2) to see if some other package causes the issue. It had the same outcome.
I currently have Kaspersky Internet Security 2018 installed. When I switch off the web anti virus feature the error does not occur! I immediately get all my desired data back from firestore.
My current workaround for development is to leave web anti virus running and to add the following url to the tursted websites within the web anti virus settings of kaspersky:
https://firestore.googleapis.com/*
This seems to work, but would only be acceptable for development.
@gamsterx It would be very helpful if you could report this as a bug to Kaspersky. Unfortunately there isn't much that we can do if 3rd-party software is blocking our network access.
I'm working on mac os (without any Kaspersky 😆) and I have the same problem:
@firebase/firestore: Firestore (5.5.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=failed-precondition]: The Cloud Firestore API is not available for Cloud Datastore projects.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
That's a totally different problem:
Most recent error: FirebaseError: [code=failed-precondition]: The Cloud Firestore API is not available for Cloud Datastore projects.
You're trying to use the Firestore API against a project that was already enabled for Cloud Datastore.
same here. In my case it was due to the Adguard I was using
Have same Problem with Kaspersky + Firestore. @mikelehen @gamsterx Report to Kaspersky is done, hopefully they lower the restrictions. https://forum.kaspersky.com/index.php?/topic/402132-kaspersky-blocks-firestore/
Thanks @pitw ! Much appreciated.
Have same Problem with Kaspersky + Firestore. @mikelehen @gamsterx Report to Kaspersky is done, hopefully they lower the restrictions. https://forum.kaspersky.com/index.php?/topic/402132-kaspersky-blocks-firestore/
Response of Kaspersky: According with some posts included on the link : The problem described happen
randomly and is Not only caused by kaspersky, but for other sources too..
So better contact "github.com" or Kaspersky Technical support
at this weblink : https://my.kaspersky.com/support
Then?
Perhaps somebody experiencing the issue can go ahead and follow the "Request Technical Support" button from https://my.kaspersky.com/support ? Be sure to let them know that at least 7 developers here are reporting that Kaspersky is preventing their Cloud Firestore apps from working and that adding https://firestore.googleapis.com/* to the trusted sites list works around the issue, but as an app developer, it's not a viable solution to ask all your customers to do that.
And if you can provide a simple site demonstrating the issue, it's probably more likely to get traction faster.
@mikelehen Its reported. We have now a trackable issue from Kasperksy. Will report here what they think.
Edit 1: They wanted some screenshots + demolinks. They got them; Now waiting how fast they are. Edit 2: "Problem +Description transmitted to Moscow, product developement "... Edit 3: Submitted 30 MB of Log files to Kaspersky as requested...waiting on final answer from product devs
Final Edit: Kaspersky opened Bug Nr. 3056440. Devs should fix this asap - then everything should work as expected.
I've been getting several exceptions caught by Sentry. I've got exceptions with Windows 10 and iOS (image below). I'm getting a lot on Windows 10.
I assume this is the same issue although I don't know how to replicate it.
Is there anything I can do to debug this further? Does reloading the page solve the problem?
Thanks.
@arturcarvalho That error message will show up when offline or on a flaky/slow internet connection, so some percentage of your customers will hit it on a regular basis. It mostly exists to help you (the developer) during debugging.
That said, if you're getting customer reports of your app not working, that is a different matter.
Thanks @mikelehen. I'll put some kind of reload screen on the site and see how it goes.
I've repurposed this issue to specifically track the issues with Firestore in conjunction with Kaspersky antivirus. For folks having other issues, please open a separate issue.
For those encountering the issue with Kaspersky, I'd appreciate it if one or two of you could test out a custom build to help us better understand the problem. Unfortunately even if this build works, it would come at the expense of performance and so it's likely not something we can ship (at least on by default). To try it:
<script include=...>
then can you point it at: https://mike-shared.firebaseapp.com/firebase-firestore.jsPlease make sure you see a log message in the console saying "THIS IS A CUSTOM FIRESTORE BUILD FOR DEBUGGING CONNECTION ISSUES" which will confirm you're picking up the right build.
If it works as-is, let me know. Else if it does not work, can you try this (and send me the output):
const db = firebase.firestore();
db.settings({
timestampsInSnapshots: true,
offlineTimeout: 75 // default is 10 seconds.
});
// Also enable debug logging:
firebase.firestore.setLogLevel('debug')
If you could also save the network log (right click on a request in Chrome developer tools and choose "Save as HAR with content") that could also be useful to look at. You can email it and any logs directly to me at michael@firebase.com.
Additionally, I'm curious to confirm if Firebase Realtime Database is affected by Kaspersky or not. So could folks try visiting https://www.firebase.com/test.html and send the output (perhaps as a gist)?
Thanks!
Is there a way this error message can be promoted into a runtime exception so a warning can be shown to the user when this happens? Right now, I think a Firestore query that should always return something is returning nothing instead of the query failing. How can I differentiate between the query result being empty or this error being the problem? I'd like to show a popup to the user that the database connection is being blocked.
I'm trying to diagnose this message with a user remotely over email but will add more if I find anything interesting...
@seanw Unfortunately the symptom that triggers the log message (our connection to the backend not succeeding in a timely manner) is completely expected in many cases (i.e. you're intentionally offline or on a flakey network connection). So we can't make it an error.
As for behavior of our APIs though, you can essentially detect this. Just create a listener with the { includeMetadataChanges: true }
option. If you get an event with snapshot.metadata.fromCache === true
and don't get a subsequent event with snapshot.metadata.fromCache === false
in a timely manner (use some sort of timeout), you can assume we're not able to reach the backend and you can show some sort of message to the user.
Hope this helps.
@mikelehen Thanks for the tips.
I can confirm this bug on Kaspersky Total Security 2018 by the way so looks like they're not updated their list of blocked URLs still. 😕
So I was having this same issue and was subscribed to this thread hoping for a solution - but then my father in law (a security guy) told me that using Kaspersky is a horrible idea. So I now suggest that the solution here is to uninstall Kaspersky wherever possible!
Yep got the same problem on a Computer with Kaspersky. Turning it off will work but I'm worried about casual users that won't know its because Kaspersky and assume the site is broken...
It seems this is no longer a problem with one AV vendor. I am experiencing the same problem using BitDefender (total security) on Mojave 10.14.2
For folks running into this issue, I'd be curious if somebody could try using this custom build:
Install via npm:
npm install https://mike-shared.firebaseapp.com/webchannel-proxy-issue/firebase-v5.7.0.tgz \
https://mike-shared.firebaseapp.com/webchannel-proxy-issue/firebase-firestore-v0.9.0.tgz \
https://mike-shared.firebaseapp.com/webchannel-proxy-issue/firebase-webchannel-wrapper-v0.2.11.tgz
Or you can point your <script include=...>
at: https://mike-shared.firebaseapp.com/webchannel-proxy-issue/firebase-firestore.js
And then initialize the SDK with a new forceLongPolling option:
const db = firebase.firestore();
db.settings({forceLongPolling: true});
You should see a log message saying:
WEBCHANNEL: ForceLongPolling enabled.
And then I'll be curious to know if your connection issue goes away. Please also provide as much detail as you can about your environment (browser, antivirus software / version, network details, etc.). Thanks!
In the beginning we had this issue with angular + firestore. Now switched to Vue.js but still have same error.
I still believe that Problem is on side of Kaspersky - tried many times to get some useful answer but except some "default answers" we didn't get any further.
It doesnt seem to concern all versions of Kaspersky (Endpoint Protection seems to work, Internet Security 2017 - 2019 seems to have this bug)
In case sb is interested we also opened up a thread on Kaspersky Forum here: https://forum.kaspersky.com/index.php?/topic/402132-kaspersky-blocks-firestore/ Feel free to post some experiences there ;)
For those who are still facing this issue and want to simulate the scenario without Kaspersky Antivirus, you can easily do it with Chrome's Dev Tools. Open the Network tab and reload the page. When a connection is attempted to firestore you'll see a request made with a name starting with channel?database=.... Right click on that request and click on Block request domain.
Sadly I couldn't find a way to simulate it in other browsers. Please share if you do.
@sydfzlbshr I'm not sure what issue you're referring to. You are welcome to try forceLongPolling and see if it has an effect, but if you're dealing with an issue NOT related to Kaspersky, please open a new github issue. This one is specifically for Kaspersky.
Also, blocking Firestore in chrome dev tools is going to completely break Firestore and make it impossible to work. I don't think we have evidence to say that this is what Kaspersky is doing. So I don't think it's an equivalent test.
I have a contact within Kaspersky asking for additional tracing, screenshots, etc. to help track this down. Is there somebody that could help out? @pitw maybe? Shoot me an email at michael@firebase.com. Thanks!
@mikelehen What kind of screenshots do you need? I am able to reproduce the issue.
@gamsterx Thanks. Actually, I think I've been able to help them reproduce it so I may not need any more info for now. Will update if/when I learn more. Thanks!
@mikelehen I tried your custom build and it works! :100: I am able to reach firestore backend even with Kasperky on.
MacOS Mojave, Safari, Kaspersky Internet Security
When will this be included in the official release? Let me know if I can help you in any other way.
@sydfzlbshr Thanks for the confirmation! I'm looking into adding the forceLongPolling
flag to an official release, but it will probably take a bit of time. In addition, we don't intend to enable it by default because it causes additional latency and bandwidth usage, so you would need to manually opt-in to the behavior.
So I'm still hoping Kaspersky can address this on their end.
I've received word from Kaspersky that they have a specific plan for addressing this which should be released in the next 2-4 weeks.
WEBCHANNEL: ForceLongPolling enabled.
And then I'll be curious to know if your connection issue goes away. Please also provide as much detail as you can about your environment (browser, antivirus software / version, network details, etc.). Thanks!
Hi @mikelehen , I tried to use your custom build but seems to me it doesn't work .. tried on last version google chrome . "WEBCHANNEL: ForceLongPolling enabled." in logs , but connections to firestore are in long pending status and then goes down with "Failed to get document because the client is offline." , is anything was changed in the firebase core since your custom build?
Everyday more and more new clients are coming to my application and it's getting harder to control all of them. I understand it's not your fault , I'm just mad about how long they don't want to solve this problem, sorry for the offtop
@Ferrasil I looked into this, and it turns out that indeed there was unfortunately a rollback on the backend that broke the forceLongPolling flag used in that test build. :-( I don't know when the behavior will be re-enabled but I'm looking into it. Sorry for the confusion.
Some updates for everyone affected by this issue, I sent a detailed report to the support and finally they confirmed about the fix in the next patch release which will be in the end of March (version E) , details will appear on this page https://support.kaspersky.com/13876
@Ferrasil Thanks. Hope that they fix it finally. What did you have to do to convince them of the bug ;) ?
@pitw IMHO No hopes they will fix it in that time lol :) Nothing special , I just made a tech support request and did some basic actions like they said : "download it , click record and we will collect data about your PC" => "download it, click record and repeat the bug case so we will see what happen" then they said : "This problem situation # 3056440 will be fixed in the nearest patch E for version 2019. The release of the patch according to preliminary data is scheduled for the end of March."
@Ferrasil I already was there ;)
(Watch the date - its from Oct 23 2018 !)
At least they give us the same bug number...
UPDATE [by @mikelehen 2018/10/21]: This issue has morphed into specifically being about the Kaspersky antivirus software blocking Firestore. Please open a separate bug if you're encountering issues without Kaspersky.
Environment
Problem
Im using Firestore with Ionic (Angularfire2 package). Any collection or doc gives error but after ~10 seconds it gives data. Auth works without any problems.
Error:
Created new Firebase Project and new Ionic project, installed packages, tried to make collection, shows same error.
The code im trying to run:
And the console output: