firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

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

Open m-nathani opened this issue 3 years ago • 19 comments

[REQUIRED] Describe your environment

  • Operating System version: Linux
  • Browser version:

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

  • Firebase SDK version: 7.16.0
  • Firebase Product: messaging

[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

m-nathani avatar May 19 '21 06:05 m-nathani

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.

looptheloop88 avatar Jun 03 '21 17:06 looptheloop88

@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.

samtstern avatar Jun 03 '21 17:06 samtstern

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.

looptheloop88 avatar Jun 03 '21 17:06 looptheloop88

Any progress on this?

mohammedhammoud avatar Mar 30 '22 09:03 mohammedhammoud

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 ?

karthikkncs14 avatar Jun 06 '22 14:06 karthikkncs14

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?

hsubox76 avatar Jun 06 '22 17:06 hsubox76

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.

hnimees avatar Aug 12 '22 04:08 hnimees

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?

digibake avatar Sep 01 '22 07:09 digibake

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

i have same issue

yogithesymbian avatar Jan 24 '23 21:01 yogithesymbian

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.

yogithesymbian avatar Jan 24 '23 21:01 yogithesymbian

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.

tomatoaiu avatar Apr 18 '23 01:04 tomatoaiu

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.

xtealer avatar Apr 24 '23 10:04 xtealer

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

iconio avatar May 05 '23 16:05 iconio

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

hernanpc-pulppo avatar Jul 21 '23 18:07 hernanpc-pulppo

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/

m-nathani avatar Nov 02 '23 07:11 m-nathani

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 🤨

olegdater avatar Feb 01 '24 08:02 olegdater