firebase no work in expo go

Please provide the following:

  1. SDK Version: Last Version
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

It works perfectly on the web, however when using the ‘Expo Go’ app on my Android phone(Android Running app on SM-G975F), I get the mentioned error.

ERROR:

@firebase/firestore: Firestore (9.6.1): Could not reach Cloud Firestore backend. Backend didn’t respond within 10 seconds.
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.

My code

import { initializeApp } from "firebase/app";
import { getFirestore, doc, setDoc, getDoc } from "firebase/firestore";

const firebaseConfig = {...};

const app = initializeApp(firebaseConfig);
const db = getFirestore(app);

export async function find(tableName, id, callback) {

	const docRef = doc(db, tableName, id.toString());
	const record = await getDoc(docRef);

	if (record.exists())
		callback(record.data());
	
}

Stack trace:
node_modules\expo\build\logs\LogSerialization.js:156:14 in _captureConsoleStackTrace
node_modules\expo\build\logs\LogSerialization.js:41:26 in serializeLogDataAsync
node_modules\regenerator-runtime\runtime.js:63:39 in tryCatch
node_modules\regenerator-runtime\runtime.js:294:21 in invoke
node_modules\regenerator-runtime\runtime.js:119:20 in define$argument_2
node_modules\regenerator-runtime\runtime.js:63:39 in tryCatch
node_modules\regenerator-runtime\runtime.js:155:19 in invoke
node_modules\regenerator-runtime\runtime.js:190:10 in PromiseImpl$argument_0
node_modules\react-native\node_modules\promise\setimmediate\core.js:45:4 in tryCallTwo
node_modules\react-native\node_modules\promise\setimmediate\core.js:200:12 in doResolve

WARNING
11:00
Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https ://github.com/facebook/react-native/issues/12981 for more info.
(Saw setTimeout with duration 402265ms)

Stack trace:
node_modules\expo\build\logs\LogSerialization.js:156:14 in _captureConsoleStackTrace
node_modules\expo\build\logs\LogSerialization.js:41:26 in serializeLogDataAsync
node_modules\regenerator-runtime\runtime.js:63:39 in tryCatch
node_modules\regenerator-runtime\runtime.js:294:21 in invoke
node_modules\regenerator-runtime\runtime.js:119:20 in define$argument_2
node_modules\regenerator-runtime\runtime.js:63:39 in tryCatch
node_modules\regenerator-runtime\runtime.js:155:19 in invoke
node_modules\regenerator-runtime\runtime.js:190:10 in PromiseImpl$argument_0
node_modules\react-native\node_modules\promise\setimmediate\core.js:45:4 in tryCallTwo
node_modules\react-native\node_modules\promise\setimmediate\core.js:200:12 in doResolve

WARNING
11:00
[Unhandled promise rejection: FirebaseError: Failed to get document because the client is offline.]

Stack trace:
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:166984:49 in next
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:165908:28 in
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:32410:20 in
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:32326:8 in _callTimer
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:32534:8 in Object.callTimers
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3911:30 in MessageQueue.__callFunction
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3639:16 in
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3865:12 in MessageQueue.__guard
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3638:13 in MessageQueue.callFunctionReturnFlushedQueue
http ://localhost:19000/debugger-ui/debuggerWorker.aca173c4.js:4:901 in

https://github.com/firebase/firebase-js-sdk/issues/5667

Unfortunately the error still occurs, I tried all the solutions presented in the mentioned post and I didn’t have success.

I would not like to switch to using React Native Firebase, or even stop using expo for the normal emulator.

But I have no idea what to do about it. :slightly_frowning_face: :frowning_face: :worried: :confused:

@firebase/firestore: Firestore (9.6.1): Could not reach Cloud Firestore backend. Backend didn’t respond within 10 seconds.
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.

@brents it looks like this issue was fixed in v9.2.0 and @adrylb appears to be using v9.6.1

That’s right 9.6.1

but doing some testing now, i realized that the error occurs when i am using ‘Debug Remote JS’ enabled, if i disable debug the error doesn’t show up on the console, just the following warning.

02:18
Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https ://github.com/facebook/react-native/issues/12981 for more info.
(Saw setTimeout with duration 518361ms)

Stack trace:
node_modules\react-native\Libraries\LogBox\LogBox.js:118:10 in registerWarning
node_modules\react-native\Libraries\LogBox\LogBox.js:64:8 in warnImpl
node_modules\react-native\Libraries\LogBox\LogBox.js:37:4 in console.warn
node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:222:6 in setTimeout
node_modules@firebase\webchannel-wrapper\dist\index.js:36:356 in wb
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:172317:14 in Oc
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:172312:8 in Bc
node_modules@firebase\webchannel-wrapper\dist\index.js:40:320 in
node_modules@firebase\webchannel-wrapper\dist\index.js:40:264 in Db
node_modules@firebase\webchannel-wrapper\dist\index.js:72:221 in
node_modules@firebase\webchannel-wrapper\dist\index.js:72:87 in n.Va
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:171770:18 in Ob
node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:123:14 in _callTimer
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:177:14 in _callImmediatesPass
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:437:30 in callImmediates
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:388:6 in __callImmediates
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:132:6 in __guard$argument_0
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:365:10 in __guard
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:131:4 in flushedQueue
[native code]:null in flushedQueue
[native code]:null in callFunctionReturnFlushedQueue

That’s right 9.6.1

but doing some testing now, i realized that the error occurs when i am using ‘Debug Remote JS’ enabled, if i disable debug the error doesn’t show up on the console, just the following warning.

> Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https ://github.com/facebook/react-native/issues/12981 for more info.
(Saw setTimeout with duration 518361ms)

Stack trace:
node_modules\react-native\Libraries\LogBox\LogBox.js:118:10 in registerWarning
node_modules\react-native\Libraries\LogBox\LogBox.js:64:8 in warnImpl
node_modules\react-native\Libraries\LogBox\LogBox.js:37:4 in console.warn
node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:222:6 in setTimeout
node_modules@firebase\webchannel-wrapper\dist\index.js:36:356 in wb
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:172317:14 in Oc
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:172312:8 in Bc
node_modules@firebase\webchannel-wrapper\dist\index.js:40:320 in
node_modules@firebase\webchannel-wrapper\dist\index.js:40:264 in Db
node_modules@firebase\webchannel-wrapper\dist\index.js:72:221 in
node_modules@firebase\webchannel-wrapper\dist\index.js:72:87 in n.Va
http ://192.168.0.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:171770:18 in Ob
node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:123:14 in _callTimer
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:177:14 in _callImmediatesPass
node_modules\react-native\Libraries\Core\Timers\JSTimers.js:437:30 in callImmediates
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:388:6 in __callImmediates
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:132:6 in __guard$argument_0
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:365:10 in __guard
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:131:4 in flushedQueue
[native code]:null in flushedQueue
[native code]:null in callFunctionReturnFlushedQueue

you should post to the issue i shared and try to get some help there! the firebase team would know best way to do

ok thank you i will do it

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.