пытается решить проблему в течение 5 часов с помощью функций базы данных Firebase в реальном времени, в 'firebase deploy':
никогда не было этого до сегодняшнего дня
Функция:
exports.makeUppercase = functions.database.ref('/userfollowers/{pushId}/followers')
.onWrite((change, context) => {
// Only edit data when it is first created.
if (change.before.exists()) {
return null;
}
// Exit when the data is deleted.
if (!change.after.exists()) {
return null;
}
// Grab the current value of what was written to the Realtime Database.
const original = change.after.val();
console.log('Uppercasing', context.params.pushId, original);
const uppercase = original.toUpperCase();
// You must return a Promise when performing asynchronous tasks inside a Functions such as
// writing to the Firebase Realtime Database.
// Setting an "uppercase" sibling in the Realtime Database returns a Promise.
return change.after.ref.parent.child('uppercase').set(uppercase);
});
which is straight out of documentation.
терминал показывает:
⚠ functions: failed to create function makeUppercase
HTTP Error: 400, The request has errors
Журналы облачных функций показывают:
{ "@ типа": "type.googleapis.com/google.cloud.audit.AuditLog", "Статус": { "код": 3, "сообщение": "INVALID_ARGUMENT"}, "authenticationInfo": { "principalEmail": "nicoaratalpes@gmail.com"}, "requestMetadata": { "CallerIP": "86.120.235.246", "callerSuppliedUserAgent": "FirebaseCLI / 3.19.0, GZIP (GFE), GZIP (GFE)", "requestAttributes": { "время": "2019-05-14T08: 34: 18.563Z", "авт": {}}, "destinationAttributes": {}}, "ServiceName": "cloudfunctions.googleapis.com", "имяМетод": "google.cloud.functions.v1.CloudFunctionsService.CreateFunction", "authorizationInfo": [{ "ресурс": "проекты / паркур-9136c / местоположение / нас-central1 / функция / makeUppercase", "разрешение": "cloudfunctions.functions.create", "получил": правда, "resourceAttributes": {}}, { "разрешение": "cloudfunctions.functions.create", "получил": правда, "resourceAttributes": {}}], "ResourceName": "проекты / паркур-9136c / место / нас-central1 / функция / makeUppercase", "запрос": { "место": "проекты / паркур-9136c / местоположение / нас-central1", "@ тип": «type.googleapis.com/google.cloud.functions.v 1.CreateFunctionRequest " "функция": { "метка": { "развертывание-инструмент": "кли-firebase"}, "Entrypoint": "makeUppercase", "EventTrigger": { "типСобытие":" провайдеры / Google. firebase.database / eventTypes / ref.write " "ресурс": "проекты / _ / экземпляры / паркур-9136c / ссылки / userfollowers / {pushId} / подписчика", "сервис": "firebaseio.com"}," sourceUploadUrl ":" https://storage.googleapis.com/gcf-upload-us-central1-f5adb7fe-7321-4f3c-8fe0-2b2307d26138/5b099ea8-161b-44a7-a3bd-18ce75c64859.zip?GoogleAccessId=service-807137615499@gcf-admin-robot.iam.gserviceaccount.com&Expires=1557824657&Signature=PJKzJsZtHWO1kIkmrSojpdgvb0jRzV91eNC9rZc4j%2FMcoHjILGm36FKCt6qQ2fxeAUu1%2FbrxpagdI7fHmUUUrDdTmnTNISr7FiN61sifUI%2B%2FGnUwo8SguzvrA7kADFqu8nD05FAo7BvG7biUrHmLgISlwo5dTKqcTSmExnaICA1tHYxjz%2Fk0RbmdGkcQ5HdeCKBnW0R7wQPsxswQyvR4cAU4WD2m3PPM9lncVr7pB%2Fh77FboGLi3sq%2FGHyEwUtjfUmyN9d%2FYUpKs48TMsGPknAGIvaFFUWQR23YCDUcrPipq1nW2W1JUdf5nGylYmVEeyF3jLrm%2BsOIcXiZ6LCRhpg%3D%3D","name":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase"}}}
в чем решение?
спасибо
https://github.com/firebase/firebase-tools/issues/1317