Firebase Appcheck fails

Viewed 185

I have an appcheck config, setup as such:

if (process.env.NODE_ENV !== 'development') {
  firebaseConfig.measurementId = process.env.VUE_APP_FIREBASE_APP_ID;
  firebaseConfig.messagingSenderId = process.env.VUE_APP_FIREBASE_MESSAGING_SENDER_ID;
  firebaseConfig.storageBucket = process.env.VUE_APP_FIREBASE_STORAGE_BUCKET;
} else {
  global.self.FIREBASE_APPCHECK_DEBUG_TOKEN = process.env.VUE_APP_FIREBASE_APPCHECK_DEBUG_TOKEN;
}
// firebase utils
const fbApp = initializeApp(firebaseConfig);

const nodeEnv = process.env.NODE_ENV;
const fbAnalytics = !(nodeEnv === 'test' || nodeEnv === 'development') ? getAnalytics() : null;
const appCheck = initializeAppCheck(fbApp, {
  provider: new ReCaptchaV3Provider(process.env.VUE_APP_RECAPTCHA_SITE_KEY),
  isTokenAutoRefreshEnabled: process.env.NODE_ENV === 'production', // refresh app tokens as needed?
});

Everything was working fine last week, but started giving me 403 erors this week, and I cannot find anything wrong. I am using the firebase emulator with appcheck, and have all the variables set and have inspected the code in the browser to make sure those variables propagated to the frontend.

[2022-06-24T04:20:29.116Z] @firebase/firestore: Firestore (9.8.4): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unknown]: Fetching auth token failed: AppCheck: Fetch server returned an HTTP error status. HTTP status: 403. (appCheck/fetch-status-error). This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

0 Answers
Related