تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يتوفّر إصداران من Cloud Functions for Firebase:
Cloud Functions (الجيل الثاني)، التي
تتيح نشر الدوال كخدمات على Cloud Run، ما يتيح لك
تشغيلها باستخدام Eventarc وPub/Sub.
Cloud Functions (الجيل الأول)، وهو الإصدار الأصلي من الدوال
الذي يتضمّن أوامر تشغيل محدودة للأحداث وإمكانية محدودة للإعداد.
ننصحك باختيار Cloud Functions (الجيل الثاني) للوظائف الجديدة
كلما أمكن ذلك. ومع ذلك، نخطّط لمواصلة إتاحة Cloud Functions (الجيل الأول).
توضّح هذه الصفحة الميزات التي تم طرحها في الإصدار Cloud Functions وتقدّم مقارنة بين إصدارَي المنتج.
Cloud Functions (الجيل الثاني)
Cloud Functions هي الجيل التالي من خدمة "الوظائف كخدمة" من Firebase. يستند Cloud Functions (الجيل الثاني) إلى Cloud Run وEventarc، ويوفّر بنية أساسية محسّنة وتغطية أوسع للأحداث في Cloud Functions، بما في ذلك:
مستندة إلى Cloud Run: يتم إنشاء الدوال باستخدام
Cloud Build ونشرها كخدمات Cloud Run باستخدام
بيئة التنفيذ التلقائية Cloud Run.
يمنحك ذلك القدرة على تخصيص وظيفتك كما تفعل مع
Cloud Run خدمة. راجِع مستندات Cloud Run للتعرّف على خيارات إعداد خدمتك، مثل حدود الذاكرة ومتغيرات البيئة وما إلى ذلك.
أوقات معالجة الطلبات الأطول: يمكنك تنفيذ مهام معالجة الطلبات الأطول، مثل معالجة كميات كبيرة من البيانات المتدفقة من Cloud Storage أو BigQuery.
أحجام أكبر للأجهزة الافتراضية: يمكنك تشغيل أعباء العمل الأكبر حجمًا التي تتطلّب حوسبة مكثّفة وتخزينًا في الذاكرة ومعالجة متوازية.
تحسين التزامن: يمكنك التعامل مع طلبات متزامنة متعددة باستخدام مثيل دالة واحد لتقليل عمليات التشغيل على البارد وتحسين وقت الاستجابة.
إدارة عدد الزيارات: يمكنك تقسيم عدد الزيارات بين مراجعات مختلفة للدالة أو إعادة دالة إلى إصدار سابق.
عملية الدمج مع Eventarc: توفير دعم أصلي لمشغّلات Eventarc، ما يتيح استخدام جميع مصادر الأحداث التي يزيد عددها عن 90 مصدرًا والمتوافقة مع Eventarc في Cloud Functions.
توافق أوسع مع CloudEvents: تتوافق جميع أوقات تشغيل اللغات مع معيار
CloudEvents، ما يوفّر تجربة متّسقة للمطوّرين.
بما أنّ Cloud Functions ينشر الوظائف كخدمات على Cloud Run،
تتشارك Cloud Functions حصص الموارد وحدودها مع Cloud Run. اطّلِع على الحصص.
جدول المقارنة
الميزة
Cloud Functions (الجيل الأول)
Cloud Functions
سجلّ الصور
Container Registry أو Artifact Registry
Artifact Registry فقط
انتهت مهلة الطلب
ما يصل إلى 9 دقائق
ما يصل إلى 60 دقيقة للدوال التي يتم تشغيلها بواسطة HTTP
ما يصل إلى 9 دقائق للوظائف التي يتم تشغيلها عند وقوع حدث
حساب الخدمة*
حساب خدمة Google App Engine (PROJECT_ID@appspot.gserviceaccount.com)
حساب خدمة الحوسبة التلقائي على Google Cloud (PROJECT_NUMBER-compute@developer.gserviceaccount.com)
حجم المثيل
ذاكرة وصول عشوائي (RAM) بسعة تصل إلى 8 غيغابايت مع وحدتَي معالجة مركزية افتراضيتَين
ذاكرة وصول عشوائي (RAM) بسعة تصل إلى 16 غيغابايت مع 4 وحدات معالجة مركزية افتراضية
التزامن
طلب متزامن واحد لكل مثيل دالة
ما يصل إلى 1,000 طلب متزامن لكل مثيل دالة
* هذا هو حساب الخدمة التلقائي المستخدَم للوصول إلى واجهات برمجة التطبيقات في Firebase أو Cloud
من دالة قيد التشغيل. تستخدِم حزمة Firebase Admin SDK هذه السمة عند بدء التشغيل بدون وسيطات.
إذا طُلب منك ذلك، اختَر حساب الفوترة المرتبط بمشروعك على Google Cloud.
في لوحة الفلاتر، ضمن التصنيفات،
أضِف فلتر تصنيفات باستخدام المفتاح
goog-managed-by والقيمة cloudfunctions.
القيود
لا يوفّر جهاز Cloud Functions for Firebase (الجيل الثاني) الدعم لأحداث Analytics.
على الرغم من أنّ Cloud Functions for Firebase (الجيل الثاني) يتيح حظر أحداث المصادقة، إلا أنّه لا يتيح المجموعة نفسها من أحداث Authentication الأساسية التي يتيحها الجيل الأول.
ومع ذلك، بما أنّه يمكن أن تتعايش دوال الجيل الأول والجيل الثاني جنبًا إلى جنب في ملف المصدر نفسه، سيظل بإمكانك تطوير ونشر مشغّلات Analytics وAuthentication الأساسية في الجيل الأول مع دوال الجيل الثاني.
تاريخ التعديل الأخير: 2025-09-06 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-09-06 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nThere are two versions of Cloud Functions for Firebase:\n\n- **Cloud Functions (2nd gen)** , which deploys your functions as services on Cloud Run, allowing you to trigger them using Eventarc and Pub/Sub.\n- **Cloud Functions (1st gen)**, the original version of functions with limited event triggers and configurability.\n\nWe recommend that you choose Cloud Functions (2nd gen) for new functions\nwherever possible. However, we plan to continue supporting Cloud Functions\n(1st gen).\n\nThis page describes features introduced in Cloud Functions and\nprovides a comparison between the two product versions.\n\nCloud Functions (2nd gen)\n\nCloud Functions is Firebase's next-generation\nFunctions-as-a-Service offering. Built on Cloud Run and\nEventarc, Cloud Functions (2nd gen) brings enhanced\ninfrastructure and broader event coverage to Cloud Functions, including:\n\n- **Built on Cloud Run** : Functions are built with Cloud Build and deployed as Cloud Run services using the default [Cloud Run execution environment](//cloud.google.com/run/docs/about-execution-environments). This gives you the ability to customize your function as you would a Cloud Run service. Refer to Cloud Run documentation to explore options for configuring your service, such as [memory\n limits](//cloud.google.com/run/docs/configuring/services/memory-limits), [environment variables](//cloud.google.com/run/docs/configuring/services/environment-variables), and so forth.\n- **Longer request processing times** : Run longer-request workloads such as processing large streams of data from Cloud Storage or BigQuery.\n- **Larger instance sizes**: Run larger in-memory, compute-intensive, and parallel workloads.\n- **Improved concurrency**: Handle multiple concurrent requests with a single function instance to minimize cold starts and improve latency.\n- **Traffic management**: Split traffic between different function revisions or roll a function back to a prior version.\n- **Eventarc integration** : Native support for Eventarc triggers, bringing all 90+ event sources supported by Eventarc to Cloud Functions.\n- **Broader CloudEvents support** : Support for industry-standard [CloudEvents](https://cloudevents.io/) in all language runtimes, providing a consistent developer experience.\n\nSee the [comparison table](#comparison-table) for details.\n\nBecause Cloud Functions deploys functions as services on Cloud Run,\nCloud Functions shares resource quotas and limits with\nCloud Run. See [Quotas](/docs/functions/quotas).\n\nComparison table\n\n| Feature | Cloud Functions (1st gen) | Cloud Functions |\n|-------------------|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| Image registry | Container Registry or Artifact Registry | Artifact Registry only |\n| Request timeout | Up to 9 minutes | - Up to 60 minutes for HTTP-triggered functions - Up to 9 minutes for event-triggered functions |\n| Service account\\* | Google App Engine service account (\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e@appspot.gserviceaccount.com) | Google Cloud default compute service account (\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e-compute@developer.gserviceaccount.com) |\n| Instance size | Up to 8GB RAM with 2 vCPU | Up to 16GiB RAM with 4 vCPU |\n| Concurrency | 1 concurrent request per function instance | Up to 1000 concurrent requests per function instance |\n\n\\* This is the default service account used to access Firebase or Cloud APIs\nfrom a running function. It is used by the Firebase Admin SDK when you\n[initialize without arguments](/docs/admin/setup#initialize-sdk).\n\nPricing\n\nFor pricing information, see [Firebase pricing plans](https://firebase.google.com/pricing#cloud-functions).\n\nYou can view your costs associated with Cloud Functions as follows:\n\n1. Go to the [Cloud Billing Reports page](https://console.cloud.google.com/billing/reports) in the Google Cloud console.\n2. If prompted, select the billing account associated with your Google Cloud project.\n3. In the **Filters** panel, under **Labels** , [add a label filter](//cloud.google.com//billing/docs/how-to/reports#filters) with the key `goog-managed-by` and the value `cloudfunctions`.\n\n| **Note:** If you are using Cloud Functions for Firebase (1st gen) and are interested in Cloud Functions, see [Upgrade 1st gen Node.js functions to 2nd gen](/docs/functions/2nd-gen-upgrade).\n\nLimitations\n\nCloud Functions for Firebase (2nd gen) does not provide support for Analytics\nevents.\n\nThough Cloud Functions for Firebase (2nd gen) supports authentication blocking\nevents, it does not support the same set of basic Authentication events as\n1st gen.\n\nHowever, because 1st gen and 2nd gen\nfunctions can coexist side-by-side in the same source file, you can still\ndevelop and deploy Analytics and basic Authentication triggers in 1st gen\ntogether with 2nd gen functions."]]