Cloud Functions से, आप अपने Cloud Firestore डेटाबेस में बदलावों से ट्रिगर हुए इवेंट को हैंडल करने के लिए, कोड डिप्लॉय कर सकते हैं. इससे आपको अपने सर्वर को चलाए बिना, अपने ऐप्लिकेशन में सर्वर-साइड की सुविधा आसानी से जोड़ने की सुविधा मिलती है.
Cloud फ़ंक्शन (2nd gen)
Cloud Run और Eventarc की मदद से काम करने वाली Cloud Functions (2nd gen) की मदद से, Firebase के लिए ज़्यादा बेहतर इन्फ़्रास्ट्रक्चर, परफ़ॉर्मेंस, और बढ़ाए जा सकने की योग्यता पर बेहतर कंट्रोल, और फ़ंक्शन रनटाइम पर ज़्यादा कंट्रोल मिलता है. 2nd gen के बारे में ज़्यादा जानकारी के लिए, Firebase के लिए Cloud Functions (2nd gen) देखें. इसके बजाय, 1st gen के बारे में ज़्यादा जानने के लिए, Cloud Firestore के साथ Cloud Functions को बढ़ाना देखें.
Cloud Firestore फ़ंक्शन ट्रिगर
'Firebase के लिए Cloud Functions', नीचे दिए गए Cloud Firestore इवेंट के ट्रिगर एक्सपोर्ट करता है. इससे आपको खास Cloud Firestore इवेंट से जुड़े हैंडलर बनाने की सुविधा मिलती है:
Node.js
इवेंट टाइप | ट्रिगर |
---|---|
onDocumentCreated |
तब ट्रिगर होता है, जब किसी दस्तावेज़ को पहली बार लिखा जाता है. |
onDocumentUpdated |
तब ट्रिगर होता है, जब कोई दस्तावेज़ पहले से मौजूद होता है और उसकी वैल्यू में बदलाव होता है. |
onDocumentDeleted |
तब ट्रिगर होता है, जब कोई दस्तावेज़ मिटाया जाता है. |
onDocumentWritten |
onDocumentCreated , onDocumentUpdated या onDocumentDeleted ट्रिगर होने पर ट्रिगर होता है. |
onDocumentCreatedWithAuthContext |
onDocumentCreated के साथ पुष्टि करने की अतिरिक्त जानकारी |
onDocumentWrittenWithAuthContext |
onDocumentWritten के साथ पुष्टि करने की अतिरिक्त जानकारी |
onDocumentDeletedWithAuthContext |
onDocumentDeleted के साथ पुष्टि करने की अतिरिक्त जानकारी |
onDocumentUpdatedWithAuthContext |
onDocumentUpdated के साथ पुष्टि करने की अतिरिक्त जानकारी |
Python (झलक)
इवेंट टाइप | ट्रिगर |
---|---|
on_document_created |
तब ट्रिगर होता है, जब किसी दस्तावेज़ को पहली बार लिखा जाता है. |
on_document_updated |
तब ट्रिगर होता है, जब कोई दस्तावेज़ पहले से मौजूद होता है और उसकी वैल्यू में बदलाव होता है. |
on_document_deleted |
तब ट्रिगर होता है, जब कोई दस्तावेज़ मिटाया जाता है. |
on_document_written |
on_document_created , on_document_updated या on_document_deleted ट्रिगर होने पर ट्रिगर होता है. |
on_document_created_with_auth_context |
on_document_created के साथ पुष्टि करने की अतिरिक्त जानकारी |
on_document_updated_with_auth_context |
on_document_updated के साथ पुष्टि करने की अतिरिक्त जानकारी |
on_document_deleted_with_auth_context |
on_document_deleted के साथ पुष्टि करने की अतिरिक्त जानकारी |
on_document_written_with_auth_context |
on_document_written के साथ पुष्टि करने की अतिरिक्त जानकारी |
Cloud Firestore इवेंट सिर्फ़ दस्तावेज़ में बदलाव पर ट्रिगर होते हैं. किसी Cloud Firestore दस्तावेज़ के अपडेट से, जिसमें डेटा में कोई बदलाव नहीं होता है (नो-ऑपरेटिव डेटा नहीं होता), न तो अपडेट जनरेट करता है और न ही इवेंट में बदलाव करता है. किसी खास फ़ील्ड में इवेंट नहीं जोड़े जा सकते.
अगर आपने अभी तक 'Firebase के लिए Cloud Functions' के लिए कोई प्रोजेक्ट चालू नहीं किया है, तो Firebase के लिए Cloud Functions (2nd gen) का इस्तेमाल करना लेख पढ़ें. इससे, अपने 'Firebase के लिए Cloud Functions' प्रोजेक्ट को कॉन्फ़िगर और सेट अप किया जा सकेगा.
Cloud Firestore से ट्रिगर किए गए फ़ंक्शन लिखना
फ़ंक्शन ट्रिगर तय करें
Cloud Firestore ट्रिगर तय करने के लिए, दस्तावेज़ का पाथ और इवेंट टाइप तय करें:
Node.js
import {
onDocumentWritten,
onDocumentCreated,
onDocumentUpdated,
onDocumentDeleted,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.myfunction = onDocumentWritten("my-collection/{docId}", (event) => {
/* ... */
});
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_created,
on_document_deleted,
on_document_updated,
on_document_written,
Event,
Change,
DocumentSnapshot,
)
@on_document_created(document="users/{userId}")
def myfunction(event: Event[DocumentSnapshot]) -> None:
दस्तावेज़ के पाथ में, किसी खास दस्तावेज़ या वाइल्डकार्ड पैटर्न का रेफ़रंस दिया जा सकता है.
किसी एक दस्तावेज़ के बारे में बताएं
अगर किसी दस्तावेज़ में किसी भी बदलाव के लिए इवेंट ट्रिगर करना है, तो इस फ़ंक्शन का इस्तेमाल करें.
Node.js
import {
onDocumentWritten,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.myfunction = onDocumentWritten("users/marie", (event) => {
// Your code here
});
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_written,
Event,
Change,
DocumentSnapshot,
)
@on_document_written(document="users/marie")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
वाइल्डकार्ड का इस्तेमाल करके दस्तावेज़ों का एक ग्रुप तय करें
अगर आपको दस्तावेज़ों के ग्रुप में ट्रिगर अटैच करना है, जैसे कि किसी कलेक्शन में मौजूद कोई दस्तावेज़, तो दस्तावेज़ आईडी की जगह {wildcard}
का इस्तेमाल करें:
Node.js
import {
onDocumentWritten,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.myfunction = onDocumentWritten("users/{userId}", (event) => {
// If we set `/users/marie` to {name: "Marie"} then
// event.params.userId == "marie"
// ... and ...
// event.data.after.data() == {name: "Marie"}
});
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_written,
Event,
Change,
DocumentSnapshot,
)
@on_document_written(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
# If we set `/users/marie` to {name: "Marie"} then
event.params["userId"] == "marie" # True
# ... and ...
event.data.after.to_dict() == {"name": "Marie"} # True
इस उदाहरण में, जब users
में किसी भी दस्तावेज़ के किसी फ़ील्ड में बदलाव किया जाता है, तो वह userId
नाम के वाइल्डकार्ड से मेल खाता है.
अगर users
के किसी दस्तावेज़ में सब-कलेक्शन हैं और उन सब-कलेक्शन के किसी दस्तावेज़ में कोई फ़ील्ड बदल जाता है, तो userId
वाइल्डकार्ड नहीं ट्रिगर होता है.
वाइल्डकार्ड से मेल खाने वाले नतीजे, दस्तावेज़ के पाथ से लिए जाते हैं और event.params
में सेव किए जाते हैं.
अश्लील कलेक्शन या दस्तावेज़ के आईडी को बदलने के लिए, जितने चाहें उतने वाइल्डकार्ड
तय किए जा सकते हैं, उदाहरण के लिए:
Node.js
import {
onDocumentWritten,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.myfunction = onDocumentWritten("users/{userId}/{messageCollectionId}/{messageId}", (event) => {
// If we set `/users/marie/incoming_messages/134` to {body: "Hello"} then
// event.params.userId == "marie";
// event.params.messageCollectionId == "incoming_messages";
// event.params.messageId == "134";
// ... and ...
// event.data.after.data() == {body: "Hello"}
});
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_written,
Event,
Change,
DocumentSnapshot,
)
@on_document_written(document="users/{userId}/{messageCollectionId}/{messageId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
# If we set `/users/marie/incoming_messages/134` to {body: "Hello"} then
event.params["userId"] == "marie" # True
event.params["messageCollectionId"] == "incoming_messages" # True
event.params["messageId"] == "134" # True
# ... and ...
event.data.after.to_dict() == {"body": "Hello"}
आपके ट्रिगर को हमेशा किसी दस्तावेज़ पर ले जाना चाहिए, भले ही आपने वाइल्डकार्ड का इस्तेमाल किया हो.
उदाहरण के लिए, users/{userId}/{messageCollectionId}
मान्य नहीं है, क्योंकि {messageCollectionId}
एक कलेक्शन है. हालांकि, users/{userId}/{messageCollectionId}/{messageId}
मान्य है, क्योंकि {messageId}
हमेशा किसी दस्तावेज़ पर ले जाएगा.
इवेंट ट्रिगर
नया दस्तावेज़ बनाने के बाद फ़ंक्शन को ट्रिगर करना
कलेक्शन में नया दस्तावेज़ बनाते समय, किसी फ़ंक्शन को ट्रिगर किया जा सकता है. हर बार नई उपयोगकर्ता प्रोफ़ाइल जोड़ने पर, यह उदाहरण फ़ंक्शन ट्रिगर होता है:
Node.js
import {
onDocumentCreated,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.createuser = onDocumentCreated("users/{userId}", (event) => {
// Get an object representing the document
// e.g. {'name': 'Marie', 'age': 66}
const snapshot = event.data;
if (!snapshot) {
console.log("No data associated with the event");
return;
}
const data = snapshot.data();
// access a particular field as you would any JS property
const name = data.name;
// perform more operations ...
});
पुष्टि करने के बारे में ज़्यादा जानने के लिए, onDocumentCreatedWithAuthContext
का इस्तेमाल करें.
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_created,
Event,
DocumentSnapshot,
)
@on_document_created(document="users/{userId}")
def myfunction(event: Event[DocumentSnapshot]) -> None:
# Get a dictionary representing the document
# e.g. {'name': 'Marie', 'age': 66}
new_value = event.data.to_dict()
# Access a particular field as you would any dictionary
name = new_value["name"]
# Perform more operations ...
दस्तावेज़ अपडेट होने पर फ़ंक्शन ट्रिगर करना
दस्तावेज़ अपडेट होने के दौरान, किसी फ़ंक्शन को फ़ायर करने के लिए भी ट्रिगर किया जा सकता है. इस उदाहरण में, फ़ंक्शन तब ट्रिगर होता है, जब कोई उपयोगकर्ता अपनी प्रोफ़ाइल बदलता है:
Node.js
import {
onDocumentUpdated,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.updateuser = onDocumentUpdated("users/{userId}", (event) => {
// Get an object representing the document
// e.g. {'name': 'Marie', 'age': 66}
const newValue = event.data.after.data();
// access a particular field as you would any JS property
const name = newValue.name;
// perform more operations ...
});
पुष्टि करने के बारे में ज़्यादा जानने के लिए, onDocumentUpdatedWithAuthContext
का इस्तेमाल करें.
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_updated,
Event,
Change,
DocumentSnapshot,
)
@on_document_updated(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
# Get a dictionary representing the document
# e.g. {'name': 'Marie', 'age': 66}
new_value = event.data.after.to_dict()
# Access a particular field as you would any dictionary
name = new_value["name"]
# Perform more operations ...
दस्तावेज़ मिटाए जाने पर फ़ंक्शन ट्रिगर करना
दस्तावेज़ मिटाए जाने के बाद भी, फ़ंक्शन ट्रिगर किया जा सकता है. यह उदाहरण जब कोई उपयोगकर्ता अपनी उपयोगकर्ता प्रोफ़ाइल मिटा देता है, तो यह फ़ंक्शन ट्रिगर हो जाता है:
Node.js
import {
onDocumentDeleted,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.deleteuser = onDocumentDeleted("users/{userId}", (event) => {
// Get an object representing the document
// e.g. {'name': 'Marie', 'age': 66}
const snap = event.data;
const data = snap.data();
// perform more operations ...
});
पुष्टि करने के बारे में ज़्यादा जानने के लिए, onDocumentDeletedWithAuthContext
का इस्तेमाल करें.
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_deleted,
Event,
DocumentSnapshot,
)
@on_document_deleted(document="users/{userId}")
def myfunction(event: Event[DocumentSnapshot|None]) -> None:
# Perform more operations ...
दस्तावेज़ में सभी बदलावों के लिए फ़ंक्शन ट्रिगर करना
अगर आपको इवेंट के टाइप से ज़्यादा फ़र्क़ नहीं पड़ता है, तो "दस्तावेज़ लिखा गया" इवेंट ट्रिगर का इस्तेमाल करके, Cloud Firestore दस्तावेज़ में हुए सभी बदलाव सुने जा सकते हैं. इस उदाहरण में, फ़ंक्शन तब सक्रिय होता है, जब कोई उपयोगकर्ता बनाया जाता है, अपडेट किया जाता है या मिटाया जाता है:
Node.js
import {
onDocumentWritten,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
exports.modifyuser = onDocumentWritten("users/{userId}", (event) => {
// Get an object with the current document values.
// If the document does not exist, it was deleted
const document = event.data.after.data();
// Get an object with the previous document values
const previousValues = event.data.before.data();
// perform more operations ...
});
पुष्टि करने के बारे में ज़्यादा जानने के लिए, onDocumentWrittenWithAuthContext
का इस्तेमाल करें.
Python (झलक)
from firebase_functions.firestore_fn import (
on_document_written,
Event,
Change,
DocumentSnapshot,
)
@on_document_written(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot | None]]) -> None:
# Get an object with the current document values.
# If the document does not exist, it was deleted.
document = (event.data.after.to_dict()
if event.data.after is not None else None)
# Get an object with the previous document values.
# If the document does not exist, it was newly created.
previous_values = (event.data.before.to_dict()
if event.data.before is not None else None)
# Perform more operations ...
डेटा पढ़ना और लिखना
जब कोई फ़ंक्शन ट्रिगर होता है, तो यह इवेंट से जुड़े डेटा का स्नैपशॉट देता है. इस स्नैपशॉट का इस्तेमाल, इवेंट को ट्रिगर करने वाले दस्तावेज़ को पढ़ने या उसमें बदलाव करने के लिए किया जा सकता है. इसके अलावा, अपने डेटाबेस के अन्य हिस्सों को ऐक्सेस करने के लिए, Firebase एडमिन SDK का इस्तेमाल किया जा सकता है.
इवेंट का डेटा
रीडिंग डेटा
जब कोई फ़ंक्शन ट्रिगर होता है, तब हो सकता है कि आप अपडेट किए गए दस्तावेज़ से डेटा लेना चाहें या अपडेट से पहले डेटा लेना चाहें. event.data.before
का इस्तेमाल करके, पिछला डेटा पाया जा सकता है. इसमें अपडेट से पहले का दस्तावेज़ का स्नैपशॉट होता है.
इसी तरह, event.data.after
में अपडेट के बाद दस्तावेज़ के स्नैपशॉट की स्थिति शामिल होती है.
Node.js
exports.updateuser2 = onDocumentUpdated("users/{userId}", (event) => {
// Get an object with the current document values.
// If the document does not exist, it was deleted
const newValues = event.data.after.data();
// Get an object with the previous document values
const previousValues = event.data.before.data();
});
Python (झलक)
@on_document_updated(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
# Get an object with the current document values.
new_value = event.data.after.to_dict()
# Get an object with the previous document values.
prev_value = event.data.before.to_dict()
किसी दूसरे ऑब्जेक्ट की तरह ही, प्रॉपर्टी को भी ऐक्सेस किया जा सकता है. इसके अलावा, खास फ़ील्ड को ऐक्सेस करने के लिए get
फ़ंक्शन का इस्तेमाल किया जा सकता है:
Node.js
// Fetch data using standard accessors
const age = event.data.after.data().age;
const name = event.data.after.data()['name'];
// Fetch data using built in accessor
const experience = event.data.after.data.get('experience');
Python (झलक)
# Get the value of a single document field.
age = event.data.after.get("age")
# Convert the document to a dictionary.
age = event.data.after.to_dict()["age"]
डेटा लिखना
हर फ़ंक्शन को शुरू करने पर, आपके Cloud Firestore डेटाबेस में एक खास दस्तावेज़ जुड़ा होता है. आपके फ़ंक्शन के स्नैपशॉट में दिए गए उस दस्तावेज़ को ऐक्सेस किया जा सकता है.
दस्तावेज़ रेफ़रंस में update()
, set()
, और remove()
जैसे तरीके शामिल होते हैं, ताकि फ़ंक्शन को ट्रिगर करने वाले दस्तावेज़ में बदलाव किया जा सके.
Node.js
import { onDocumentUpdated } from "firebase-functions/v2/firestore";
exports.countnamechanges = onDocumentUpdated('users/{userId}', (event) => {
// Retrieve the current and previous value
const data = event.data.after.data();
const previousData = event.data.before.data();
// We'll only update if the name has changed.
// This is crucial to prevent infinite loops.
if (data.name == previousData.name) {
return null;
}
// Retrieve the current count of name changes
let count = data.name_change_count;
if (!count) {
count = 0;
}
// Then return a promise of a set operation to update the count
return data.after.ref.set({
name_change_count: count + 1
}, {merge: true});
});
Python (झलक)
@on_document_updated(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
# Get the current and previous document values.
new_value = event.data.after
prev_value = event.data.before
# We'll only update if the name has changed.
# This is crucial to prevent infinite loops.
if new_value.get("name") == prev_value.get("name"):
return
# Retrieve the current count of name changes
count = new_value.to_dict().get("name_change_count", 0)
# Update the count
new_value.reference.update({"name_change_count": count + 1})
उपयोगकर्ता की पुष्टि करने की जानकारी ऐक्सेस करें
अगर इनमें से किसी एक तरह के इवेंट का इस्तेमाल किया जाता है, तो इवेंट को ट्रिगर करने वाले मुख्य खाते के बारे में उपयोगकर्ता की पुष्टि करने की जानकारी ऐक्सेस की जा सकती है. यह जानकारी, बेस इवेंट में दी गई जानकारी से अलग होती है.
Node.js
onDocumentCreatedWithAuthContext
onDocumentWrittenWithAuthContext
onDocumentDeletedWithAuthContext
onDocumentUpdatedWithAuthContext
Python (झलक)
on_document_created_with_auth_context
on_document_updated_with_auth_context
on_document_deleted_with_auth_context
on_document_written_with_auth_context
पुष्टि करने से जुड़े डेटा के बारे में जानने के लिए, पुष्टि करने का कॉन्टेक्स्ट देखें. नीचे दिए गए उदाहरण में, पुष्टि करने की जानकारी पाने का तरीका बताया गया है:
Node.js
import { onDocumentWrittenWithAuthContext } from "firebase-functions/v2/firestore"
exports.syncUser = onDocumentWrittenWithAuthContext("users/{userId}", (event) => {
const snapshot = event.data.after;
if (!snapshot) {
console.log("No data associated with the event");
return;
}
const data = snapshot.data();
// retrieve auth context from event
const { authType, authId } = event;
let verified = false;
if (authType === "system") {
// system-generated users are automatically verified
verified = true;
} else if (authType === "unknown" || authType === "unauthenticated") {
// admin users from a specific domain are verified
if (authId.endsWith("@example.com")) {
verified = true;
}
}
return data.after.ref.set({
created_by: authId,
verified,
}, {merge: true});
});
Python (झलक)
@on_document_updated_with_auth_context(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
# Get the current and previous document values.
new_value = event.data.after
prev_value = event.data.before
# Get the auth context from the event
user_auth_type = event.auth_type
user_auth_id = event.auth_id
वह डेटा जो ट्रिगर इवेंट से बाहर का है
Cloud Functions, भरोसेमंद माहौल में काम करता है. इन्हें आपके प्रोजेक्ट पर सेवा खाते के तौर पर अनुमति दी गई है. साथ ही, Firebase एडमिन SDK का इस्तेमाल करके, कॉन्टेंट को पढ़ने और लिखने की सुविधा दी जा सकती है:
Node.js
const { initializeApp } = require('firebase-admin/app');
const { getFirestore, Timestamp, FieldValue } = require('firebase-admin/firestore');
initializeApp();
const db = getFirestore();
exports.writetofirestore = onDocumentWritten("some/doc", (event) => {
db.doc('some/otherdoc').set({ ... });
});
exports.writetofirestore = onDocumentWritten('users/{userId}', (event) => {
db.doc('some/otherdoc').set({
// Update otherdoc
});
});
Python (झलक)
from firebase_admin import firestore, initialize_app
import google.cloud.firestore
initialize_app()
@on_document_written(document="some/doc")
def myfunction(event: Event[Change[DocumentSnapshot | None]]) -> None:
firestore_client: google.cloud.firestore.Client = firestore.client()
firestore_client.document("another/doc").set({
# ...
})
सीमाएं
Cloud Functions के लिए Cloud Firestore ट्रिगर के लिए इन सीमाओं पर ध्यान दें:
- ऑर्डर करने की कोई गारंटी नहीं है. तीव्र बदलाव किसी अनपेक्षित क्रम में फ़ंक्शन को शुरू करने को ट्रिगर कर सकते हैं.
- इवेंट कम से कम एक बार डिलीवर किए जाते हैं, लेकिन किसी एक इवेंट की वजह से कई फ़ंक्शन शुरू हो सकते हैं. एक बार होने वाली मैकेनिक्स पर निर्भर रहने से बचें और खराब फ़ंक्शन लिखें.
- Datastore मोड में Cloud Firestore के लिए Cloud Functions (2nd gen) की ज़रूरत होती है. Cloud Functions (1st gen) में, डेटास्टोर मोड काम नहीं करता.
- Cloud Functions (1st gen) सिर्फ़ "(डिफ़ॉल्ट)" डेटाबेस के साथ काम करता है और यह Cloud Firestore नाम वाले डेटाबेस के साथ काम नहीं करता. नाम वाले डेटाबेस के लिए इवेंट कॉन्फ़िगर करने के लिए, कृपया Cloud Functions (2nd gen) का इस्तेमाल करें.
- ट्रिगर, किसी एक डेटाबेस से जुड़ा होता है. एक से ज़्यादा डेटाबेस से मैच करने वाला ट्रिगर नहीं बनाया जा सकता.
- किसी डेटाबेस को मिटाने से, उस डेटाबेस के ट्रिगर अपने-आप नहीं मिटते हैं. ट्रिगर, इवेंट को डिलीवर करना बंद कर देता है, लेकिन वह तब तक मौजूद रहता है, जब तक ट्रिगर को मिटाया नहीं जाता.
- अगर मैच होने वाले किसी इवेंट में, अनुरोध की संख्या से ज़्यादा हो जाती है, तो हो सकता है कि वह इवेंट Cloud Functions (1st gen) पर न भेजा जाए.
- अनुरोध के साइज़ की वजह से डिलीवर नहीं होने वाले इवेंट, प्लैटफ़ॉर्म लॉग में लॉग इन किए जाते हैं. साथ ही, इन्हें प्रोजेक्ट के लॉग के इस्तेमाल के तौर पर गिना जाता है.
- आपको ये लॉग, लॉग एक्सप्लोरर में
error
की गंभीरता की सीमा से ज़्यादा होने की वजह से Cloud फ़ंक्शन पर डिलीवर नहीं किया जा सका. साथ ही, ये लॉग मिल सकते हैं. फ़ंक्शन का नाम,functionName
फ़ील्ड में देखा जा सकता है. अगरreceiveTimestamp
फ़ील्ड अब भी एक घंटे बाद का है, तो बताए गए दस्तावेज़ को पढ़कर, असल इवेंट के कॉन्टेंट का अनुमान लगाया जा सकता है. इसके लिए, टाइमस्टैंप से पहले और बाद में मिले स्नैपशॉट का इस्तेमाल करें. - इस तरह के वीडियो अपलोड न करने के लिए, ये काम किए जा सकते हैं:
- Cloud Functions (2nd gen) पर माइग्रेट और अपग्रेड करना
- दस्तावेज़ का साइज़ छोटा करें
- वे Cloud Functions मिटाएं जिनके बारे में जानकारी दी गई है
- बाहर रखे गए इवेंट का इस्तेमाल करके, डेटा लॉग करने की सुविधा बंद की जा सकती है. हालांकि, ध्यान रखें कि आपत्तिजनक इवेंट अब भी डिलीवर नहीं किए जा सकेंगे.