Open ASE55471 opened 1 year ago
@ASE55471 did you find any solution?
@josephepia No, I still have no ideas on this issue.
@ASE55471 my workaround was to manually add the database url to the index.ts file and then remove it before submitting a production.
functions/src/index.ts
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
admin.initializeApp({
databaseURL: "http://127.0.0.1:9000/?ns=nameProject-default-rtdb", //<- add and remove
});
It can be improved with a condition where it checks if it is in the emulator environment with FUNCTIONS_EMULATOR==true
How to detect if environment is development or production
Version info
**firebase-functions-test:"^2.4.0"
**firebase-functions:"^3.23.0"
**firebase-admin:"^11.0.1"
Test case
function code
test code
I tried fill
databaseURL
without "-default-rtdb" but still throw same error.Relative StackOverflow question I asked: https://stackoverflow.com/questions/73657752/how-to-initialize-admin-sdk-with-firebase-functions-test
Expected behavior
Finish the test without error .
Actual behavior
It throw error.