Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
m-nathani opened this issue May 19, 2021 · 19 comments

Comments

@m-nathani
Copy link

m-nathani commented May 19, 2021

[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
@looptheloop88
Copy link

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
Copy link
Contributor

@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
Copy link

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
Copy link

Any progress on this?

@karthikkncs14
Copy link

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
Copy link
Contributor

hsubox76 commented Jun 6, 2022

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

await messaging.firebaseDependencies.installations.getId()

and

const authToken = await installations.getToken();

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
Copy link

hnimees commented Aug 12, 2022

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
Copy link

digibake commented Sep 1, 2022

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
Copy link

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

i have same issue

@yogithesymbian
Copy link

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
Copy link

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
Copy link

xtealer commented Apr 24, 2023

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
Copy link

iconio commented May 5, 2023

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
Copy link

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
Copy link
Author

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
Copy link

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
Copy link

khabouss commented Sep 2, 2024

Any updates on this issue?

@heytulsiprasad
Copy link

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
Copy link

khabouss commented Sep 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests