如果您無法存取 Firebase 控制台中的項目,請檢查您是否有權存取 Google Cloud 控制台中的項目。您可以在 Google Cloud 控制台的IAM頁面中查看專案成員列表,包括所有者。
如果您專案的擁有者無法再執行所有者的任務(例如,該人員離開了您的公司),並且您的專案不是透過 Google Cloud 組織管理的(請參閱下一段),您可以聯絡 Firebase 支援團隊指定的臨時所有者。
請注意,如果 Firebase 專案屬於 Google Cloud 組織,則它可能沒有所有者。相反,管理您的 Google Cloud 組織的人員可以執行所有者可以執行的許多任務。但是,要執行多項特定於所有者的任務(例如指派角色或管理 Google Analytics(分析)屬性),管理員可能需要為自己指派實際的擁有者角色來執行這些任務。如果您無法找到 Firebase 專案的擁有者,請聯絡管理您的 Google Cloud 組織的人員來為該專案指派所有者。
為什麼或何時應該為專案成員指派所有者角色?
為了確保 Firebase 專案的正確管理,它必須有一個Owner 。專案擁有者是可以執行多項重要管理作業(例如指派角色和管理 Google Analytics 屬性)的人,Firebase 支援只能滿足經過證明的專案擁有者的管理請求。
為 Firebase 專案設定所有者後,保持這些分配最新非常重要。
請注意,如果 Firebase 專案是 Google Cloud 組織的一部分,則管理您的 Google Cloud 組織的人員可以執行所有者可以執行的許多任務。但是,對於多項特定於所有者的任務(例如指派角色或管理 Google Analytics(分析)屬性),管理員可能需要為自己指派實際的擁有者角色才能執行這些任務。
Google Analytics(分析)是一種免費且無限的分析解決方案,可與Firebase功能一起使用以提供強大的見解。它使您可以在crashlytics,FCM中的通知效果,動態連結的深層連結效能以及從Google Play的應用程式內購買資料中查看事件日誌。它可以為遠端配置,遠端配置個人化等高級受眾定位提供動力。
Google Analytics(分析)在Firebase控制台中充當智慧層,可為您提供有關如何開發高品質應用程序,成長用戶群並賺更多錢的更可行的見解。
Firebase身份驗證:在我的Android應用程式中,為什麼我會遇到以下錯誤: Google sign in failed ?
如果您收到以下錯誤,請依照此常見問題的故障排除步驟:
GoogleFragment: Google sign in failed
com.google.android.gms.common.api.ApiException: 13: Unable to get token.
at
com.google.android.gms.internal.auth-api.zbay.getSignInCredentialFromIntent(com.google.android.gms:play-services-auth@@20.3.0:6)
Otherwise, the %APP_NAME% will be the default Firebase Hosting site name (the value preceding .firebaseapp.com and .web.app and usually the Firebase project ID).
Note that if the lookup of the default Firebase Hosting site name fails, then the final fallback is to use the Firebase project ID as the %APP_NAME% .
雲端功能
Cloud Functions runtime support
How do I upgrade to the latest supported version of Node.js?
How can I make sure I deployed my functions to a specific Node.js runtime?
In the Firebase console, go to the functions dashboard , select a function, and check the function's language under Additional details .
I use Firebase Extensions. Will I be affected by Cloud Functions runtime updates?
是的。 Since extensions use Cloud Functions , the runtime of your extensions will need to be updated on the same timeline as Cloud Functions.
We recommend that you periodically update to the latest version of each extension installed in your project. You can upgrade your projects' extensions via the Firebase console or Firebase CLI .
雲端訊息傳遞
Cloud Messaging: What's the difference between the Notifications composer and Cloud Messaging?
Firebase Cloud Messaging provides a complete set of messaging capabilities through its client SDKs and HTTP and XMPP server protocols. For deployments with more complex messaging requirements, FCM is the right choice.
The Notifications composer is a lightweight, serverless messaging solution built on Firebase Cloud Messaging. With a user-friendly graphical console and reduced coding requirements, the Notifications composer lets users easily send messages to reengage and retain users, foster app growth, and support marketing campaigns.
能力
Notifications composer
雲端訊息傳遞
目標
單一設備
Clients subscribed to topics (ie weather)
Clients in predefined user segment (app, version, language)
Clients in specified analytics audiences
Clients in device groups
Upstream from client to server
訊息類型
Notifications up to 2kb
Data messages up to 4kb
送貨
即時
Future client device local time
分析
Built-in Notifications analytics collection and funnel analytics
Cloud Messaging: Apple announced they're deprecating the legacy binary protocol for APNs.我需要做些什麼嗎?
No. Firebase Cloud Messaging switched to the HTTP/2-based APNs protocol in 2017. If you are using FCM to send notifications to iOS devices, there should be no action required on your part.
Cloud Messaging: Do I need to use other Firebase services in order to use FCM?
You can use Firebase Cloud Messaging as a standalone component, in the same manner as you did with GCM, without using other Firebase services.
Cloud Messaging: I am an existing Google Cloud Messaging (GCM) developer. Should I move to Firebase Cloud Messaging?
FCM is the new version of GCM under the Firebase brand. It inherits GCM's core infrastructure, with new SDKs to make Cloud Messaging development easier.
Benefits of upgrading to FCM SDK include:
Simpler client development. You no longer have to write your own registration or subscription retry logic.
An out-of-the-box notification solution. You can use the Notifications composer, a serverless notifications solution with a web console that lets anyone send notifications to target specific audiences based on insights from Google Analytics.
To upgrade from GCM SDKs to FCM SDKs, see the guides for migrating Android and iOS apps.
Cloud Messaging: Why do my targeted devices apparently fail to receive messages?
When it looks like devices haven't successfully received messages, check first for these two potential causes:
Foreground message handling for notification messages . Client apps need to add message handling logic to handle notification messages when the app is in the foreground on the device. See the details for iOS and Android .
Network firewall restrictions . If your organization has a firewall that restricts the traffic to or from the Internet, you need to configure it to allow connectivity with FCM in order for your Firebase Cloud Messaging client apps to receive messages. The ports to open are:
5228
5229
5230
FCM usually uses 5228, but it sometimes uses 5229 and 5230. FCM does not provide specific IPs, so you should allow your firewall to accept outgoing connections to all IP addresses contained in the IP blocks listed in Google's ASN of 15169 .
Cloud Messaging: I have implemented onMessageReceived in my Android app, but it is not being called.
When your app is in the background, notification messages are displayed in the system tray, and onMessageReceived is not called. For notification messages with a data payload, the notification message is displayed in the system tray, and the data that was included with the notification message can be retrieved from the intent launched when the user taps on the notification.
Notifications composer: What's the difference between the Notifications composer and Cloud Messaging?
The Notifications composer is a lightweight, serverless messaging solution built on Firebase Cloud Messaging. With a user-friendly graphical console and reduced coding requirements, the Notifications composer lets users easily send messages to reengage and retain users, foster app growth, and support marketing campaigns.
Firebase Cloud Messaging provides a complete set of messaging capabilities through its client SDKs and HTTP and XMPP server protocols. For deployments with more complex messaging requirements, FCM is the right choice.
Here's a comparison of the messaging capabilities provided by Firebase Cloud Messaging and the Notifications composer:
能力
Notifications composer
雲端訊息傳遞
目標
單一設備
Clients subscribed to topics (ie weather)
Clients in predefined user segment (app, version, language)
Clients in specified analytics audiences
Clients in device groups
Upstream from client to server
訊息類型
Notifications up to 2kb
Data messages up to 4kb
送貨
即時
Future client device local time
分析
Built-in Notifications analytics collection and funnel analytics
Notifications composer: I am an existing Google Cloud Messaging (GCM) developer, and I want to use the Notifications composer.我該怎麼辦?
The Notifications composer is an out-of-the-box solution that lets anyone send notifications to target specific audiences based on insights from Google Analytics. Also, the Notifications composer provides funnel analysis for every message, allowing easy evaluation of notification effectiveness.
If you are an existing GCM developer, to use the Notifications composer you have to upgrade from GCM SDKs to FCM SDKs. See the guides for migrating Android and iOS apps.
FCM features deprecated in June 2023
Which FCM APIs were deprecated on June 20, 2023, and what should I do if I am using those APIs?
The following APIs/SDKs will be affected by the deprecation:
伺服器API
API名稱
API端點
對使用者的影響
需要採取的行動
Legacy HTTP protocol
https://fcm.googleapis.com/fcm/send
Requests to the endpoint will start failing after 6/21/2024.
API calls to FirebaseMessaging.send in the app won't trigger upstream messages to the app server after 6/21/2024.
Implement this functionality in your server logic. For example, some developers implement their own HTTP/gRPC endpoint and call the endpoint directly to send messages from their clients to the app server. See this gRPC Quick start for an example implementation of upstream messaging using gRPC.
Batch Send API
https://fcm.googleapis.com/batch
Requests to the endpoint will start failing after 6/21/2024.
These APIs will stop working after 6/21/2024 because they call the batch send API .
Upgrade to the latest Firebase Admin SDK and use the new APIs instead: sendEach()/ sendEachAsync()/send_each()/sendEachForMulticast()/sendEachForMulticastAsync()/ send_each_for_multicast() .
Note that the new APIs no longer call the deprecated batch send API, and for this reason they may create more concurrent HTTP connections than the old APIs.
客戶端 SDK
SDK versions
對使用者的影響
需要採取的行動
GCM SDKs (deprecated in 2018)
Apps using GCM SDKs will not be able to register tokens nor receive messages from FCM after 6/21/2024.
Upgrade your Android SDK to the latest Firebase SDK if you haven't already done so.
JS SDKs version <7.0.0 (breaking change at version 7.0.0 in 2019)
Web apps using older JS SDKs will not be able to register tokens after 6/21/2024.
Upgrade your Firebase Web SDK to the latest version.
Will I see a service downgrade before June 2024?
No. You have 12 months (06/20/2023 - 06/21/2024) to migrate from the old APIs to new APIs without any service downgrade. We strongly recommend you to plan the migration as early as possible so you won't be impacted by the decommissioning of the APIs in June 2024.
After June 2024, you may see increased errors or lack of functionality when using the APIs/SDKs listed above.
What's the difference between OAuth 2.0 tokens and server keys?
An OAuth 2.0 token is a short-lived token derived from a service account . It's Google's standard auth model and it's more secure than static server keys.
Note that the request headers differ when you use OAuth 2.0 tokens for requests to different endpoints.
HTTP v1 API : Authorization: Bearer $oauth_token
Instance ID server API and Device group management API : Authorization: Bearer $oauth_token access_token_auth: true
Can I migrate my requests to the new API all at once?
We recommend that you slowly ramp up your traffic to the new API. If you expect to send more than 600,000 messages/min on a regular basis, contact Firebase support for instructions on how to increase quota or get recommendations on how to spread out traffic.
What's the difference between the HTTP v1 API and the legacy APIs when I send messages to topics/device groups?
Topics: you don't need to add the "/topics/" prefix to your topic target when you use the v1 API.
Device groups: You can use a group token as a token target in the HTTP v1 API. However, the HTTP v1 API doesn't return the success/failure counts in the response. We recommend that you use FCM topics or manage your device groups by yourself.
Does the HTTP v1 API support sending messages to multiple tokens in one request?
No. This feature, called "multicast" in legacy HTTP APIs, is not supported by the HTTP v1 API, which is better designed for scalability.
For use cases where end-to-end latency is critical, or where total fanout size is small (fewer than 1 million), Google recommends sending multiple separate requests using the HTTP v1 API. The HTTP v1 API over HTTP/2 performs similarly for 99.9% of multicast requests (sending < 100 tokens). For outlier use cases (sending 1000 tokens), it achieves up to a third of the throughput rate, so additional concurrency is needed to optimize for this atypical use case. Users can experience more reliability and availability with the HTTP v1 API than with legacy multicast.
For use cases where throughput and egress bandwidth are prioritized or where total fanout size is large (greater than 1 million), Google recommends topic messaging. While topic messaging requires a one-time action to subscribe recipients to a topic, it offers up to a 10,000 QPS per project fanout rate without a maximum limit on topic size.
What versions of the Firebase Admin SDK have the new APIs?
平台
Firebase Admin SDK version
Node.js
>=11.7.0
Python
>=6.2.0
爪哇
>=9.2.0
去
>=4.12.0
。網
>=2.4.0
What's the difference between the batch send API and the HTTP v1 API?
The FCM batch send API uses the same message format and authentication mechanism as the HTTP v1 API. However, it uses a different endpoint. If you want to improve efficiency, you should consider using HTTP/2 to send multiple requests over the same HTTP connection to the HTTP v1 API.
What should I do if I can't access my project?
Please reach out to the Google Cloud support team for help.
Firebase 雲端儲存
Cloud Storage for Firebase: Why can't I use Cloud Storage for Firebase?
Cloud Storage for Firebase creates a default bucket in the App Engine no-cost tier. This allows you to quickly get up and running with Firebase and Cloud Storage for Firebase, without having to put in a credit card or enable a Cloud Billing account. It also allows you to easily share data between Firebase and a Google Cloud project.
There are, however, two known cases where this bucket cannot be created and you will be unable to use Cloud Storage for Firebase:
A project imported from Google Cloud which had a App Engine Master/Slave Datastore application.
A project imported from Google Cloud which has domain prefixed projects. For example: domain.com:project-1234 .
There are currently no workarounds to these issues, and we recommend that you create a new project in the Firebase console and enable Cloud Storage for Firebase in that project.
Cloud Storage for Firebase: Why do I get error code 412 responses about service account permissions and failed service account operations when using the Cloud Storage for Firebase API?
It's likely you're getting 412 error codes either because the Cloud Storage for Firebase API is not enabled for your project or a necessary service account is missing the required permissions.
Cloud Storage for Firebase: On Spark plan projects, can I store executable files?
For no-cost (Spark) plan projects, Firebase blocks uploads and hosting of certain executable file types for Windows, Android and Apple by Cloud Storage for Firebase and Firebase Hosting. This policy exists to prevent abuse on our platform.
Serving, hosting and file uploads of disallowed files are blocked for all Spark projects created on or after Sept 28th, 2023. For existing Spark projects with files uploaded before that date, such files can still be uploaded and hosted.
This restriction applies to Spark plan projects. Projects on the pay as you go (Blaze) plan are not affected.
The following file types cannot be hosted on Firebase Hosting and Cloud Storage for Firebase:
Windows files with .exe , .dll and .bat extensions
Android files with .apk extension
Apple platform files with .ipa extension
我需要做什麼?
If you still want to host these file types after September 28th, 2023:
For Hosting: upgrade to the Blaze plan before you can deploy these file types to Firebase Hosting via the firebase deploy command.
For Storage: upgrade to the Blaze plan to upload these file types to the bucket of your choice using the GCS CLI, the Firebase console, or Google Cloud console.
Use Firebase tools to manage your Firebase Hosting and Cloud Storage resources.
For managing resources in Firebase Hosting, use the Firebase console to delete releases according to this guide .
For managing resources in Cloud Storage, navigate to the Storage product page in your project.
On the Files tab, locate disallowed files to delete in your folder hierarchy, then select them using the checkbox next to the filename(s) on the left-hand side of the panel.
Click Delete , and confirm the files were deleted.
Cloud Storage for Firebase: Why do I see an unexpected increase in upload and download operations?
Previously, download and upload requests to the Cloud Storage for Firebase API were not being counted properly. We have taken steps to fix this issue, starting from September 15, 2023.
For Blaze users, upload and download operations will start counting towards your monthly bill. For Spark users, they will start counting towards your monthly free limit.
We recommend monitoring your Usage page for any increases that may count towards your limits.
Cloud Storage for Firebase: Why do I see new service account IDs associated with my Firebase projects that use Cloud Storage for Firebase?
Firebase uses service accounts to operate and manage services without sharing user credentials. When you create a Firebase project, you might notice that a number of service accounts are already available in your project.
The service account that Cloud Storage for Firebase uses is scoped to your project and is named service- PROJECT_NUMBER @gcp-sa-firebasestorage.iam.gserviceaccount.com .
If you used Cloud Storage for Firebase before September 19, 2022, you may see an additional service account on previously-linked Cloud Storage buckets named firebase-storage@system.gserviceaccount.com . As of September 19, 2022, this service account is no longer supported.
You can view all service accounts associated with your project in the Firebase console, on the Service accounts tab .
Adding the new service account
If you removed the service account previously or the service account is not present in your project, you may do one of the following to add the account.
(Recommended) Automated: Use the AddFirebase REST endpoint to re-import your bucket into Firebase. You will only need to call this endpoint once, not once for each linked bucket.
We strongly discourage you from removing the service account because this may block access to your Cloud Storage buckets from your apps. To remove the service account from your project, follow the instructions in Disabling a service account .
Dynamic Links: Why does my Android app access each Dynamic Link twice?
The getInvitation API clears the saved Dynamic Link to prevent it from being accessed twice. Be sure to call this API with the autoLaunchDeepLink parameter set to false in each of the deep link activities to clear it for the case when the activity is triggered outside the main activity.
Firebase Local Emulator Suite
Why do Emulator Suite logs show an error starting with "Multiple projectIds are not recommended in single project mode"?
This message means the Emulator Suite has detected it may be running a particular product emulator using different project IDs. This may indicate a misconfiguration, and can cause issues when emulators try to communicate with one another, and when you try to interact with emulators from your code. If project IDs don't match, it often appears that data is missing, since data stored in emulators is keyed to projectID, and interoperability depends on matching project IDs.
This has been a common source of confusion among developers, so by default the Local Emulator Suite will now only allow running with a single project ID, unless you specify otherwise in the firebase.json configuration file. If an emulator detects more than one project ID, it will log a warning and potentially throw a fatal error.
Check your project ID declaration(s) for mismatches in:
The default project set at the command line. By default, the project ID will be taken on startup from the project selected with firebase init or firebase use . To view the list of projects (and see which one is selected) use firebase projects:list .
Unit tests. The project ID is often specified in calls to the Rules Unit Testing library methods initializeTestEnvironment or initializeTestApp . Other testing code may initialize with initializeApp(config) .
The command line --project flag. Passing the Firebase CLI --project flag overrides the default project. You'll need to ensure the value of the flag matches the project ID in unit tests and app initialization.
Platform-specific places to check:
網路
The projectId property in your JavaScript firebaseConfig object, used in initializeApp .
安卓
The project_id property inside the google-services.json configuration file.
蘋果平台
The PROJECT_ID property in the GoogleService-Info.plist configuration file.
To disable single project mode, update firebase.json with the singleProjectMode key:
Hosting: On Spark plan projects, can I store executable files?
For no-cost (Spark) plan projects, Firebase blocks uploads and hosting of certain executable file types for Windows, Android and Apple by Cloud Storage for Firebase and Firebase Hosting. This policy exists to prevent abuse on our platform.
Serving, hosting and file uploads of disallowed files are blocked for all Spark projects created on or after Sept 28th, 2023. For existing Spark projects with files uploaded before that date, such files can still be uploaded and hosted.
This restriction applies to Spark plan projects. Projects on the pay as you go (Blaze) plan are not affected.
The following file types cannot be hosted on Firebase Hosting and Cloud Storage for Firebase:
Windows files with .exe , .dll and .bat extensions
Android files with .apk extension
Apple platform files with .ipa extension
我需要做什麼?
If you still want to host these file types after September 28th, 2023:
For Hosting: upgrade to the Blaze plan before you can deploy these file types to Firebase Hosting via the firebase deploy command.
For Storage: upgrade to the Blaze plan to upload these file types to the bucket of your choice using the GCS CLI, the Firebase console, or Google Cloud console.
Use Firebase tools to manage your Firebase Hosting and Cloud Storage resources.
For managing resources in Firebase Hosting, use the Firebase console to delete releases according to this guide .
For managing resources in Cloud Storage, navigate to the Storage product page in your project.
On the Files tab, locate disallowed files to delete in your folder hierarchy, then select them using the checkbox next to the filename(s) on the left-hand side of the panel.
Click Delete , and confirm the files were deleted.
Hosting: Why does my Hosting release history table in the Firebase console show file counts that are more than what my local project actually has?
Firebase automatically adds extra files containing metadata about the Hosting site, and these files are included in the total file count for the release.
Hosting: What's the largest file size that I can deploy to Firebase Hosting?
Hosting has a maximum size limit of 2 GB for individual files.
We recommend storing larger files using Cloud Storage , which offers a maximum size limit in the terabyte range for individual objects.
Hosting: How many Hosting sites can I have per Firebase project?
Performance Monitoring: How many custom URL patterns can I create?
You can create up to 400 total custom URL patterns per app and up to 100 custom URL patterns per domain for that app.
Performance Monitoring: Why am I not seeing real time display of performance data?
To view real time performance data, make sure that your app uses a Performance Monitoring SDK version that's compatible with real time data processing.
iOS — v7.3.0 or later
tvOS — v8.9.0 or later
Android — v19.0.10 or later (or Firebase Android BoM v26.1.0 or later)
Web — v7.14.0 or later
Note that we always recommend using the latest version of SDK, but any version listed above will enable Performance Monitoring to process your data in near real time.
即時資料庫
Realtime Database: Why was my Realtime Database reported bandwidth lower than average between September 2016 and March 2017?
For our bandwidth calculations, we normally include SSL encryption overhead (based on layer 5 of the OSI model). However, in September 2016, we introduced a bug that caused our bandwidth reporting to ignore encryption overhead. This might have resulted in artificially low reported bandwidth and bills on your account for a few months.
We released a fix for the bug in late March 2017, returning bandwidth reporting and billing to their normal levels.
Realtime Database: What are the scaling limitations of the Realtime Database?
Each Realtime Database instance has limits on the number of write operations per second. For small writes, this limit is approximately 1000 write operations per second. If you are approaching this limit, batching operations using multi-path updates can help you achieve higher throughput.
Realtime Database: What can I do if I'm over my Realtime Database usage limits?
If you've received an email alert or notification in the Firebase console that you've exceeded your Realtime Database usage limits, you can address it based on the usage limit you've exceeded. To see your Realtime Database usage, go to the Realtime Database Usage dashboard in the Firebase console.
If you're over your download limit, you can upgrade your Firebase pricing plan or wait until your download limit resets at the start of your next billing cycle. To decrease your downloads, try the following steps:
Add queries to limit the data that your listen operations return.
Check for unindexed queries.
Use listeners that only download updates to data — for example, on() instead of once() .
Use security rules to block unauthorized downloads.
If you're over your storage limit, upgrade your pricing plan to avoid service disruptions. To reduce the amount of data in your database, try the following steps:
Run periodic cleanup jobs.
Reduce any duplicate data in your database.
Note that it may take some time to see any data deletions reflected in your storage allotment.
If you're over your simultaneous database connections limit, upgrade your plan to avoid any service disruptions. To manage simultaneous connections to your database, try connecting via users via the REST API if they don't require a realtime connection.
遠端配置
Remote Config: Why don't fetched values change the behavior and appearance of my app?
Unless you fetch values with fetchAndActivate() , values are stored locally but not activated. To activate fetched values so that they can take effect, call activate . This design lets you control when the behavior and appearance of your app changes, because you can choose when to call activate . After you call activate , your app source code determines when updated parameter values are used.
For example, you could fetch values and then activate them the next time a user starts your app, which removes the need to delay app startup while your app waits for fetched values from the service. Changes to your app's behavior and appearance then occur when your app uses the updated parameter values.
Remote Config: I am making a lot of fetch requests while developing my app. Why doesn't my app always get the latest values from the service when it sends fetch requests?
During app development, you might want to fetch and activate configs very frequently (many times per hour) to let you rapidly iterate as you develop and test your app. To accommodate rapid iteration on a project with up to 10 developers, you can temporarily set a FirebaseRemoteConfigSettings object with a low minimum fetch interval ( setMinimumFetchIntervalInSeconds ) in your app.
Remote Config: How quickly does the Remote Config service return fetched values after my app sends a fetch request?
Devices usually receive fetched values in less than a second, and often receive fetched values in milliseconds. The Remote Config service handles fetch requests within milliseconds, but the time required to complete a fetch request will depend on the network speed of the device and the latency of the network connection used by the device.
If your goal is to make fetched values take effect in your app as soon as possible, but without creating a jarring user experience, consider adding calls to fetchAndActivate each time that your app does a full screen refresh.
Firebase User Segmentation Storage stores Firebase installation IDs and related attributes and segments as well as audience lists you've created to provide targeting information to other Firebase services that use them, such as Crashlytics, FCM, Remote Config personalization, and more.