Fixed firebase production issues. Mismatched vapid key + caching.
This commit is contained in:
@@ -3,15 +3,26 @@ importScripts(
|
||||
"https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js"
|
||||
);
|
||||
|
||||
// firebase.initializeApp({
|
||||
// apiKey: "AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU",
|
||||
// authDomain: "imex-prod.firebaseapp.com",
|
||||
// databaseURL: "https://imex-prod.firebaseio.com",
|
||||
// projectId: "imex-prod",
|
||||
// storageBucket: "imex-prod.appspot.com",
|
||||
// messagingSenderId: "253497221485",
|
||||
// appId: "1:253497221485:web:3c81c483b94db84b227a64",
|
||||
// measurementId: "G-NTWBKG2L0M",
|
||||
// });
|
||||
|
||||
firebase.initializeApp({
|
||||
apiKey: "AIzaSyDV9MsSHZmpLtjoaTK_ObvjFaJ-nMSd2KA",
|
||||
authDomain: "bodyshop-dev-b1cb6.firebaseapp.com",
|
||||
databaseURL: "https://bodyshop-dev-b1cb6.firebaseio.com",
|
||||
projectId: "bodyshop-dev-b1cb6",
|
||||
storageBucket: "bodyshop-dev-b1cb6.appspot.com",
|
||||
messagingSenderId: "922785209028",
|
||||
appId: "1:922785209028:web:96e9df15401eee5d784791",
|
||||
measurementId: "G-2D5378VCHE",
|
||||
apiKey: "AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc",
|
||||
authDomain: "imex-dev.firebaseapp.com",
|
||||
databaseURL: "https://imex-dev.firebaseio.com",
|
||||
projectId: "imex-dev",
|
||||
storageBucket: "imex-dev.appspot.com",
|
||||
messagingSenderId: "759548147434",
|
||||
appId: "1:759548147434:web:e8239868a48ceb36700993",
|
||||
measurementId: "G-K5XRBVVB4S",
|
||||
});
|
||||
|
||||
const messaging = firebase.messaging();
|
||||
|
||||
@@ -6,6 +6,7 @@ import "firebase/analytics";
|
||||
import "firebase/messaging";
|
||||
|
||||
const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
|
||||
console.log("Firebase config", config);
|
||||
firebase.initializeApp(config);
|
||||
|
||||
export const auth = firebase.auth();
|
||||
@@ -37,11 +38,13 @@ export const updateCurrentUser = (userDetails) => {
|
||||
let messaging;
|
||||
try {
|
||||
messaging = firebase.messaging();
|
||||
messaging.usePublicVapidKey(
|
||||
// Project Settings => Cloud Messaging => Web Push certificates
|
||||
// Project Settings => Cloud Messaging => Web Push certificates
|
||||
// messaging.usePublicVapidKey(process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY);
|
||||
messaging.usePublicVapidKey(process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY);
|
||||
console.log(
|
||||
"Firebase Messaging initialized successfully.",
|
||||
process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY
|
||||
);
|
||||
console.log("Firebase Messaging initialized successfully.");
|
||||
} catch {
|
||||
console.log("Firebase Messaging is likely unsupported.");
|
||||
}
|
||||
|
||||
@@ -2,12 +2,6 @@ var admin = require("firebase-admin");
|
||||
const path = require("path");
|
||||
require("dotenv").config({ path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || 'development'}`) });
|
||||
|
||||
console.log(
|
||||
"Found Firebase AdminSDK JSON",
|
||||
process.env.NODE_ENV,
|
||||
!!process.env.FIREBASE_ADMINSDK_JSON
|
||||
);
|
||||
|
||||
var serviceAccount = require(process.env.FIREBASE_ADMINSDK_JSON);
|
||||
|
||||
admin.initializeApp({
|
||||
|
||||
Reference in New Issue
Block a user