Closed shuneihayakawa closed 3 years ago
Same issue, only happen when trying to use makeDocumentSnapshot
yet
Same here
On one hand, I think I see a bug, but on the other, this code sample doesn't follow the SDK's instructions. If you're going to use a credentials file, you should pass that value as the second parameter to initialize your tests:
const tester = test({}, process.env.GOOGLE_APPLICATION_CREDENTIALS);
Version info
firebase-functions-test: 0.2.3 firebase-functions: 3.13.2 firebase-admin: 9.5.0
Test case
makeUppercase
function introduced in official firebase guideinitializeApp({ credential: credential.applicationDefault(), });
export const makeUppercase = functionBuilder('asia-northeast1') .firestore.document('/messages/{documentId}') .onCreate(async (snapshot) => { const original = snapshot.data().original as string; const uppercase = original.toUpperCase(); await snapshot.ref.set({ uppercase }, { merge: true }); });
Steps to reproduce
Clone this repo and follow these steps
functions/service-account-key.json
Expected behavior
firebase-functions-test
is able to read the credential fromcredential.applicationDefault()
Actual behavior