Skill 01 · Extension To Functions Codebase
Subchapter 1.3
references/signature-mapping.mdMarkdown4 KBView on GitHub
This reference maps legacy V1 functions to their modern V2 equivalents. When using the compatibility shim, you can destructure the V2 event object using the exact parameter names from the legacy V1 trigger signature (, , , ) alongside .
changesnapshotmessageobjectcontext| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|---|---|---|
firestore.document().onWrite() | onDocumentWritten() | ({ change, context }) |
firestore.document().onCreate() | onDocumentCreated() | ({ snapshot, context }) |
firestore.document().onUpdate() | onDocumentUpdated() | ({ change, context }) |
firestore.document().onDelete() | onDocumentDeleted() | ({ snapshot, context }) |
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|---|---|---|
pubsub.topic().onPublish() | onMessagePublished() | ({ message, context }) |
pubsub.schedule().onRun() | onSchedule() | Access event directly |
[!NOTE] Scheduled functions moved from the
pubsubnamespace to theschedulernamespace in V2.
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|---|---|---|
database.ref().onWrite() | onValueWritten() | ({ change, context }) |
database.ref().onCreate() | onValueCreated() | ({ snapshot, context }) |
database.ref().onUpdate() | onValueUpdated() | ({ change, context }) |
database.ref().onDelete() | onValueDeleted() | ({ snapshot, context }) |
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|---|---|---|
storage.object().onArchive() | onObjectArchived() | ({ object, context }) |
storage.object().onDelete() | onObjectDeleted() | ({ object, context }) |
storage.object().onFinalize() | onObjectFinalized() | ({ object, context }) |
storage.object().onMetadataUpdate() | onObjectMetadataUpdated() | ({ object, context }) |
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|---|---|---|
https.onRequest() | https.onRequest() | Standard Express (req, res) |
https.onCall() | https.onCall() | Destructure ({ data, auth }) |
[!IMPORTANT] HTTP Callables do NOT use the Destructuring Shim. In V2, the handler receives a single
CallableRequestobject (not aCloudEvent). You should destructure properties likedata,auth, andappdirectly from it. The traditionalcontextobject is unavailable.
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|---|---|---|
auth.user().beforeSignIn() | identity.beforeUserSignedIn() | Access event directly |
auth.user().beforeCreate() | identity.beforeUserCreated() | Access event directly |
[!NOTE] Auth Blocking triggers moved to the
identitynamespace in V2.
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|---|---|---|
tasks.taskQueue().onDispatch() | onTaskDispatched() | Access event directly |