firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.85k stars 891 forks source link

FirebaseError Installations: Could not process request. Application offline. (installations/app-offline). #4922

Open m-nathani opened 3 years ago

m-nathani commented 3 years ago

[REQUIRED] Describe your environment

Google Chrome | 90.0.4430.212 (Official Build) (64-bit)

[REQUIRED] Describe the problem

Got the below on ErrorBoundry of my application using Sentry..

FirebaseError Installations: Could not process request. Application offline. (installations/app-offline).

Moreover, please find the below for complete stacktrace of it..

Relevant Code:

../../src/helpers/get-installation-entry.ts in triggerRegistrationIfNecessary at line 98:23

../../src/helpers/get-installation-entry.ts in triggerRegistrationIfNecessary at line 98:23

): InstallationEntryWithRegistrationPromise {
  if (installationEntry.registrationStatus === RequestStatus.NOT_STARTED) {
    if (!navigator.onLine) {
      // Registration required but app is offline.
      const registrationPromiseWithError = Promise.reject(
        ERROR_FACTORY.create(ErrorCode.APP_OFFLINE)
      );
      return {
        installationEntry,
        registrationPromise: registrationPromiseWithError
      };
../../src/helpers/get-installation-entry.ts at line 49:30

): Promise<InstallationEntryWithRegistrationPromise> {
  let registrationPromise: Promise<RegisteredInstallationEntry> | undefined;
  const installationEntry = await update(appConfig, oldEntry => {
    const installationEntry = updateOrCreateInstallationEntry(oldEntry);
    const entryWithPromise = triggerRegistrationIfNecessary(
      appConfig,
      installationEntry
    );
    registrationPromise = entryWithPromise.registrationPromise;
    return entryWithPromise.installationEntry;
../../src/helpers/idb-manager.ts in call at line 102:20

  if (dbPromise) {
    (await dbPromise).close();
    await deleteDb(DATABASE_NAME);
    dbPromise = null;
  }
}
function getKey({ appConfig }: FirebaseInternalDependencies): string {
  return appConfig.appId;
}
Called from: ../node_modules/tslib/tslib.es6.js in step
looptheloop88 commented 3 years ago

Hi @m-nathani, thanks for the report and for patiently waiting. Firebase Installations Service (used by other Firebase products such as FCM, Analytics, AB testing and Remote Config in order to work) requires network connection to initialize and for periodic refreshes. This error might occur if the app is experiencing a network issue and eventually becomes offline.

I’ll close this issue, because it’s not a bug in the SDK.

samtstern commented 3 years ago

@looptheloop88 is it a bug that this error is uncaught? I agree that the offline issue is not an SDK bug but I think it could probably surface in a better way, maybe as a warning or an error that could be caught by the developer.

looptheloop88 commented 3 years ago

You mean like in FCM? If the app doesn't have a connection, then the SDK should throw an error? That makes sense. Let me reopen this issue.

mohammedhammoud commented 2 years ago

Any progress on this?

karthikkncs14 commented 2 years ago

What is the update on this? how can we handle this silently ? this error is begin logged in sentry as well and how can we avoid it ?

hsubox76 commented 2 years ago

I think there's 2 places in messaging that call installations methods that could throw this error:

https://github.com/firebase/firebase-js-sdk/blob/497d34c8472a19cb8baca56985c98346e5a4727d/packages/messaging/src/helpers/logToFirelog.ts#L162

and

https://github.com/firebase/firebase-js-sdk/blob/497d34c8472a19cb8baca56985c98346e5a4727d/packages/messaging/src/internals/requests.ts#L157

Tracing these back, it looks like one of the paths that can lead to this code is the getToken() method which we could probably get to throw an error that developers can catch. But it looks like there's 2 paths leading to this call that are triggered by subscription events? (onPush and onSubChange?) and in order to let the developer catch those we'd need to add an error callback or something? To onMessage or onBackgroundMessage maybe? I'm not extremely familiar with the messaging SDK, maybe @zwu52 has some ideas.

For those reporting the problem I don't suppose if you know if you're getting it on getToken() or on some kind of subscription event?

hnimees commented 2 years ago

Just checking in to ask if there's any update on this? Also running into this issue with remote config and was wondering how I could catch and handle this error.

digibake commented 2 years ago

Hi, I've just started to get this error as well in a production web app. Is there a fix, or any other information to help with this?

yogithesymbian commented 1 year ago
chunk-vendors.65328bc0.js:449 Uncaught (in promise) FirebaseError: Installations: Could not process request. Application offline. (installations/app-offline).

i have same issue

yogithesymbian commented 1 year ago
chunk-vendors.65328bc0.js:449 Uncaught (in promise) FirebaseError: Installations: Could not process request. Application offline. (installations/app-offline).

i have same issue

but i have just solve by (⌘ + q) to my chrome and re open.

tomatoaiu commented 1 year ago

I had a similar issue as well. Although I couldn't fix it with code, I found that sometimes simply turning off and on the Wi-Fi on my PC would resolve the problem.

xtealer commented 1 year ago

I had a similar issue as well. Although I couldn't fix it with code, I found that sometimes simply turning off and on the Wi-Fi on my PC would resolve the problem.

This seems to work. I cannot find an explanation. Application was broken in production and development.

iconio commented 1 year ago

I have the problem but in my case it was when I'm using the browser on Incognito mode. Hope it helps someone.

hernanpc-pulppo commented 1 year ago

I had a similar issue as well. Although I couldn't fix it with code, I found that sometimes simply turning off and on the Wi-Fi on my PC would resolve the problem.

This seems to work for everyone having the same issue... trange though

m-nathani commented 1 year ago

I got the same issue today.. basically it happens when the user ha no-connectivity

Heres the link to stacktrace for the issue found:

https://umai.sentry.io/share/issue/351ba9a34c4546ebbc4c3f4fade00e8a/

olegdater commented 9 months ago

I have the problem but in my case it was when I'm using the browser on Incognito mode. Hope it helps someone.

same thing happened in chrome incognito mode, turning on/off wifi helped 🤨

khabouss commented 2 months ago

Any updates on this issue?

heytulsiprasad commented 2 months ago

Any updates on this issue?

I don't know why it seemed to appear all of a sudden, I've never seen this before. But the simplest way of solving:

  1. Turn on/off your wifi (or airplane mode on/off)
  2. Hard reload with clear cache

Got the idea from @tomatoaiu, so thanks!

khabouss commented 2 months ago

@heytulsiprasad I'm getting this error in Sentry in prod