You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase Functions 1.0:beta-v1差异文档未收录event.params.pushId与event.data.ref

Firebase Functions Beta → 1.0: Migration Details for event.params.pushId and event.data.ref

Hey there, I totally get the frustration when you’re digging through official migration docs and can’t track down specific details on the APIs you rely on. Let’s break down exactly what happened to those two properties in the 1.0 release:

What Replaces event.params.pushId?

In the beta version, when you set up a Realtime Database trigger with a wildcard path like /items/{pushId}, you’d grab the auto-generated push ID via event.params.pushId.

In 1.0+, the original event object was split into two focused parameters: change (for data-related values) and context (for metadata like request context and path placeholders). Now, that push ID lives under the context object:

context.params.pushId

This pattern applies to all path wildcards, not just push IDs—any placeholder you define in your trigger path will be accessible via context.params.

What Replaces event.data.ref?

In beta, event.data was a single DataSnapshot representing the state that triggered the function, and event.data.ref gave you the direct Database Reference to that location.

In 1.0+, Realtime Database triggers use a change parameter that includes both before and after snapshots (to handle create, update, and delete events cleanly). To get the reference to the triggered location:

  • For create/update events: Use change.after.ref
  • For delete events: Use change.before.ref

If you’re working with Firestore triggers instead, you’ll find the equivalent reference under context.resource.ref.

The official beta-to-1.0 diff doc focuses more on high-level structural shifts (like the split of event into change and context) rather than listing every single property migration, which is why these specific details might not be called out explicitly.

内容的提问来源于stack exchange,提问作者Isaak Osipovich Dunayevsky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:00:15