Я пишу простое веб-приложение с Firebase-хостингом и облачными функциями.Мои функции - OnCreate, OnDelete и httpsServer.Я не хочу тестировать свое приложение, запустив его локально.Как это сделать, поскольку firebase serve
работает только с функцией https и хостингом.
Я попытался одновременно запустить firebase serve
и firebase functions:shell
на разных терминалах bash.Это приводит к сбою firebase functions:shell
.
Функция создания :
exports.created = functions.firestore.document('Books/{bookID}')
.onCreate((snapshot, context) => {
FUNCTION_BODY
});
Функция удаления :
exports.deleted = functions.firestore.document('Books/{bookID}')
.onDelete((snapshot, context) => {
FUNCTION_BODY
});
Функция https :
exports.app = functions.https.onRequest(app);
Ошибка, выдаваемая из bash :
$ firebase functions:shell
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.13.0 but Google Cloud Functions only supports v6.11.5.
! functions: Failed to emulate created
! functions: Failed to emulate deleted
! functions: Failed to emulate app
i functions: No functions to emulate.
No functions emulated.
Выход из второго bash :
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.13.0 but Google Cloud Functions only supports v6.11.5.
i hosting: Serving hosting files from: public
+ hosting: Local server: http://localhost:5000
info: initalised
info: rendering home...
+ functions: app: http://localhost:5001/book-shelf-be347/us-central1/app
info: Worker for app closed due to file changes.
Примечание : Это отдельные терминалы bash, работающие одновременно на одной машине.