Skip to content

Missing App configuration value apiKey projectId appId for firebase-messaging-sw.js template #86

@wandriputra

Description

@wandriputra

Hello,

I use this only for firebase-messaging / handling notifications in my application.

but I found the provider.ts problem: 109 Uncaught FirebaseError: Installations: Missing App configuration value: "projectId" (installations / missing-app-config-values).

which makes it unable to register the default service worker like this screenshot below

i u
image

the solution I found was to add apiKey projectId appId to the firebase-messaging-sw.js templates like the line of code below.

const version = options.firebaseVersion
const apiKey = options.apiKey // i add this line
const projectId = options.projectId // i add this line
const appId = options.appId // i add this line
const messagingSenderId = options.messagingSenderId
const onFirebaseHosting = options.onFirebaseHosting

if (onFirebaseHosting) {
  // Only works on Firebase hosting!
  importScripts('/__/firebase/' + version + '/firebase-app.js')
  importScripts('/__/firebase/' + version + '/firebase-messaging.js')
  importScripts('/__/firebase/init.js')
}
else {
  importScripts(
    'https://www.gstatic.com/firebasejs/' + version + '/firebase-app.js'
  )
  importScripts(
    'https://www.gstatic.com/firebasejs/' + version + '/firebase-messaging.js'
  )
  firebase.initializeApp({
    apiKey, // i add this line
    projectId, // i add this line
    appId, // i add this line
    messagingSenderId: messagingSenderId
  })
} 

does this lead to an issue or am I miss configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions