-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
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
Update CloudEvent types #1089
Update CloudEvent types #1089
Conversation
This commit makes several updates to the exported CloudEvent types. * Billing types include a notificationType * [Link](https://github.com/googleapis/google-cloudevents/blob/main/proto/google/events/firebase/firebasealerts/v1/cloud_event_payload.proto#L132-L133) * Crashlytics have more documentation on fields * Storage has an exported `StorageEvent` which includes the bucket. * Storage function api references `StorageEvent` to better match to expected output.
Updated more signatures to optionally expect a bucket.
@@ -382,7 +389,7 @@ export function getOptsAndBucket( | |||
bucket = bucketOrOpts; | |||
opts = {}; | |||
} else { | |||
bucket = bucketOrOpts.bucket || firebaseConfig().storageBucket; | |||
bucket = bucketOrOpts.bucket || firebaseConfig()?.storageBucket; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the NPE culprit. firebaseConfig() is nullable, so attempting to access storageBucket
throw an exception.
principalEmail: string; | ||
/** The type of the notification, e.g. upgrade, downgrade */ | ||
notificationType: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh nice catch, I think I missed this field and meant to add it a while ago 🤦♂️
bucket: string; | ||
} | ||
|
||
export type StorageEvent = CloudEvent<StorageObjectData, WithBucket>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting, I didn't realize that storage also uses custom extension attributes.
Updates to exported CloudEvent Types
This commit makes several updates to the exported CloudEvent types.
storageBucket
from a null firebase configStorageEvent
which includes the bucket.StorageEvent
to better match to expected output.Description
Code sample