We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node: 16.20.0
firebase-functions: 4.4.1
firebase-tools: 12.3.0
firebase-admin: 11.10.1
export const exampleHandler = onDocumentCreated('example/{docId}', async (event) => { const docId = event.data?.id; // event data is possibly undefined info(docId); });
I expect every Firestore event to, at minimum, have data on what occurred and never be undefined.
I am required to handle the possibility of undefined data on all Firestore events as per the following type defs:
export declare function onDocumentWritten<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>; export declare function onDocumentWritten<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>; export declare function onDocumentCreated<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>; export declare function onDocumentCreated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>; export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>; export declare function onDocumentUpdated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>; export declare function onDocumentDeleted<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>; export declare function onDocumentDeleted<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
Yes
The text was updated successfully, but these errors were encountered:
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Sorry, something went wrong.
I'm also interested in this? In what scenario would event.data be undefined?
Background: event for onDocumentWritten is typed as:
FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>
There may be some documentation missing here. I'll label it as such
blidd-google
No branches or pull requests
Related issues
[REQUIRED] Version info
node: 16.20.0
firebase-functions: 4.4.1
firebase-tools: 12.3.0
firebase-admin: 11.10.1
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
[REQUIRED] Expected behavior
I expect every Firestore event to, at minimum, have data on what occurred and never be undefined.
[REQUIRED] Actual behavior
I am required to handle the possibility of undefined data on all Firestore events as per the following type defs:
Were you able to successfully deploy your functions?
Yes
The text was updated successfully, but these errors were encountered: