-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
[REQUIRED] Environment info
firebase-tools:9.2.2
Platform:macOS
[REQUIRED] Test case
Check the steps to reproduce. It does not require anything else. Downgrading firebase-tools to, say, 8.16.2, works with that same code.
[REQUIRED] Steps to reproduce
Have emulators running, then
process.env.FIREBASE_AUTH_EMULATOR_HOST = 'localhost:9099'
process.env.FIRESTORE_EMULATOR_HOST = 'localhost:8080'
process.env.NODE_ENV = 'development'
process.env.FIREBASE_TOKEN = 'FAKE_TOKEN'
firebaseTools.firestore.delete(userRef.path, {
project: admin.instanceId().app.options.projectId,
recursive: true,
yes: true
})
[REQUIRED] Expected behavior
Before this commit (9d90a94), which added apiv2 to requireAuth.ts, having process.env.FIREBASE_TOKEN = 'FAKE_TOKEN'
was enough to work with the local emulator. After this change, it's not possible.
There was a fix for api.js here (https://github.com/firebase/firebase-tools/pull/2211/files/3a7515e2339c571d1f389ecd42dfc597703ea06e#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed) which uses var getTokenPromise = secureRequest ? api.getAccessToken() : Promise.resolve({ access_token: "owner" });
. apiv2 on the other hand has just const token = await this.getAccessToken()
[REQUIRED] Actual behavior
Error is returned: "Failed to fetch page after undefined FirebaseError: HTTP Error: 400, invalid jwt" from apiv2.js