קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
יש שתי גרסאות של Cloud Functions for Firebase:
Cloud Functions (דור שני), שפורס את הפונקציות כשירותים ב-Cloud Run, ומאפשר להפעיל אותן באמצעות Eventarc ו-Pub/Sub.
Cloud Functions (דור ראשון), הגרסה המקורית של הפונקציות
עם טריגרים מוגבלים לאירועים ואפשרויות מוגבלות להגדרה.
מומלץ לבחור באפשרות Cloud Functions (דור שני) לפונקציות חדשות, בכל מקום שאפשר. עם זאת, אנחנו מתכננים להמשיך לתמוך ב-Cloud Functions
(דור ראשון).
בדף הזה מתוארות התכונות שהושקו ב-Cloud Functions ומוצג השוואה בין שתי גרסאות המוצר.
Cloud Functions (דור שני)
Cloud Functions הוא הדור הבא של Firebase של שירות Functions-as-a-Service. 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)
גודל המכונה
עד 8GB RAM עם 2 vCPU
עד 16GiB RAM עם 4 vCPU
הפעלה בו-זמנית
בקשה מקבילה אחת לכל מופע של פונקציה
עד 1,000 בקשות בו-זמנית לכל מופע של פונקציה
* זהו חשבון השירות שמוגדר כברירת מחדל ומשמש לגישה ל-Firebase או ל-Cloud APIs מפונקציה שפועלת. הוא משמש את Firebase Admin SDK כשמבצעים אתחול ללא ארגומנטים.
Cloud Functions for Firebase (דור שני) לא תומך באירועים מסוג Analytics.
למרות ש-Cloud Functions for Firebase (דור שני) תומך באירועים של חסימת אימות, הוא לא תומך באותה קבוצה של אירועי Authentication בסיסיים כמו דור ראשון.
עם זאת, מכיוון שפונקציות מדור ראשון ומדור שני יכולות להתקיים זו לצד זו באותו קובץ מקור, עדיין אפשר לפתח ולפרוס טריגרים של Analytics וטריגרים בסיסיים של Authentication בדור ראשון יחד עם פונקציות מדור שני.
[[["התוכן קל להבנה","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 (שעון UTC)."],[],[],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."]]