Cloud Run functions 和 Firebase
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google Cloud Run functions 和 Cloud Functions for Firebase 一同构成了 Google 无服务器计算解决方案的重要组成部分,旨在创建事件驱动型应用。
Google Cloud Platform 开发者可将 Cloud Run functions 用作连接层,从而通过监听并响应事件来构建各 Google Cloud Platform (GCP) 服务之间的逻辑。
Firebase 开发者可以借助 Cloud Functions for Firebase 通过添加服务器端代码来扩展 Firebase 的行为并集成 Firebase 功能。
这两种解决方案都在完全受管的环境中快速可靠地执行函数,因此您无需为管理服务器或配置基础架构而担心。
Cloud Functions for Firebase
如果您要开发移动应用或移动 Web 应用,则应使用 Cloud Functions for Firebase。Firebase 为移动开发者提供一系列以移动设备为中心的全代管式服务,包括分析、身份验证和 Realtime Database。Cloud Functions 使得该产品更加完善,让您可以通过添加服务器端代码来扩展和关联 Firebase 功能的行为。
Firebase 开发者可以轻松集成外部服务,以处理付款和发送短信等操作。此外,开发者还可以添加过于庞大而不适合在移动设备上处理的自定义逻辑,或者需要在服务器上进行安全保护的自定义逻辑。
探索使用场景,详细了解典型的集成。开发者如果需要功能更全面的后端,则可借由 Cloud Run functions 使用 Google Cloud Platform 中的强大功能。
Cloud Functions for Firebase 针对 Firebase 开发者进行了优化:
- 借助 Firebase SDK 通过代码配置您的函数
- 与 Firebase 控制台和 Firebase CLI 相集成
- 不但具有与 Google Cloud Functions 相同的触发器,还有 Firebase Realtime Database、Firebase Authentication 和 Firebase Analytics 触发器
开发者可以通过以函数形式编写代码来关联和扩展 GCP 服务。您可将 Cloud Run functions 作为连接层,通过监听并响应事件在 GCP 服务之间构建逻辑。只需几行代码,开发者就可以提升其对 GCP 服务的使用,创建更高级别的组合,而无需配置或管理服务器。
如需了解详情,请参阅 Google Cloud Run functions 文档。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-17。
[null,null,["最后更新时间 (UTC):2025-08-17。"],[],[],null,["\u003cbr /\u003e\n\nGoogle Cloud Run functions and Cloud Functions for Firebase together\ncomprise an important part of Google's serverless compute solution for creating\nevent-driven applications.\n\nFor **Google Cloud Platform developers** , [Cloud Run\nfunctions](https://cloud.google.com/functions/) serve as a connective layer\nallowing you to weave logic between Google Cloud Platform (GCP) services by\nlistening for and responding to events.\n\nFor **Firebase developers** ,\n[Cloud Functions for Firebase](https://firebase.google.com/docs/functions/)\nprovides a way to extend the behavior of Firebase and integrate Firebase\nfeatures through the addition of server-side code.\n\nBoth solutions provide fast and reliable execution of functions in a fully\nmanaged environment where there's no need for you to worry about managing any\nservers or provisioning any infrastructure.\n\nCloud Functions for Firebase\n\nYou should use Cloud Functions for Firebase if you're a developer building a\nmobile app or mobile web app. Firebase gives mobile developers access to a\ncomplete range of fully managed mobile-centric services including analytics,\nauthentication and Realtime Database. Cloud Functions rounds out the offering\nby providing a way to extend and connect the behavior of Firebase features\nthrough the addition of server-side code.\n\nFirebase developers can easily integrate with external services for tasks like\nprocessing payments and sending SMS messages. Also, developers can include\ncustom logic that is either too heavyweight for a mobile device, or\nwhich needs to be secured on a server.\n[Explore use cases](https://firebase.google.com/docs/functions/use-cases)\nto learn more about typical integrations.\nFor developers that need a more full-featured backend, Cloud Run\nfunctions provides a gateway to the powerful capabilities in\n[Google Cloud Platform](https://cloud.google.com/docs/).\n\nCloud Functions for Firebase is optimized for Firebase developers:\n\n- Firebase SDK to configure your functions through code\n- Integrated with Firebase Console and Firebase CLI\n- The same triggers as Google Cloud Functions, plus Firebase Realtime Database, Firebase Authentication, and Firebase Analytics triggers\n\nCloud Run functions for Google Cloud Platform\n\nDevelopers can connect and extend GCP services by writing code in the form of a\nfunction. Cloud Run functions serve as a connective layer allowing you to\nweave logic between GCP services by listening for and responding to events. With\njust a few lines of code, developers can enrich their use of GCP services to\ncreate higher level combinations without needing to provision or manage servers.\nSee the [Google Cloud Run functions\ndocumentation](https://cloud.google.com/functions/docs/) for more information."]]