Firebase Config Node
Overview
The Firebase Config node is a configuration node that provides Firebase authentication and connection management for all Vision Platform nodes. It handles Firebase initialization, real-time data synchronization, and connection state management.
Key Features
- Central configuration: Single source of Firebase credentials
- Auto-reconnection: Handles connection failures gracefully with exponential backoff and health checks (v1.2.2+)
- Real-time sync: Live updates for datasets and models
- Connection events: Emits events for connection state changes
- Credential validation: Validates Firebase config on startup
- Model caching: Caches model information for performance
- Dataset caching: Caches dataset metadata
Configuration
Firebase Credentials
Firebase configuration requires a JSON object with Firebase project credentials:
{
"apiKey": "AIzaSy...",
"authDomain": "project-id.firebaseapp.com",
"projectId": "project-id",
"storageBucket": "project-id.appspot.com",
"messagingSenderId": "123456789",
"appId": "1:123456789:web:abcdef"
}How to Get Firebase Credentials
- Go to Firebase Console
- Select your project
- Go to Project Settings (gear icon)
- Scroll to "Your apps" section
- Click on your web app or create one
- Copy the Firebase configuration object
Configuration Steps
- Add firebase-config node (double-click in editor sidebar)
- Paste Firebase JSON configuration
- Click "Update" or "Add"
- Reference this config in other Vision Platform nodes
Connection States
States
| State | Description |
|---|---|
disconnected | Not connected to Firebase |
connecting | Attempting connection |
connected | Successfully connected |
error | Connection failed |
Exponential Backoff (v1.2.2+)
When a connection fails, the node uses exponential backoff for reconnection attempts combined with periodic health checks. This prevents overwhelming Firebase during outages and ensures reliable automatic recovery once the service is available again.
Connection Events
The node emits events that other nodes can listen to:
firebase-connecting: Connection attempt startingfirebase-connected: Successfully connectedfirebase-disconnected: Connection lostfirebase-connection-error: Connection faileddatasets-updated: Dataset list changedmodels-updated: Model list changed
Data Synchronization
Datasets
The config node automatically synchronizes dataset information:
- Dataset names and IDs
- Tag statistics (image counts per tag)
- Dataset types (multiclass, multilabel, etc.)
Accessible via: firebaseNode.datasets
Models
The config node automatically synchronizes model information:
- Model names and IDs
- Associated datasets
- Task types
- Update timestamps
Accessible via: firebaseNode.models
Usage in Other Nodes
Referencing Config
All Vision Platform nodes have a "Firebase Config" dropdown:
- Select the firebase-config node you created
- Node will automatically connect
- Data available once connected
Example Nodes Using Firebase Config
- Inferencer: Downloads models from Firebase
- Dataset Upload: Uploads images to Firebase Storage
- From Dataset: Streams images from Firebase
- List Dataset: Lists available datasets
- List Model: Lists available models
- OCR Inferencer: Performs OCR inference using models from Firebase
- Triton Inferencer: Downloads and converts models from Firebase for Triton inference
Error Handling
Common Errors
"Invalid Firebase configuration"
Cause: JSON config malformed or missing required fields
Solution:
- Verify JSON is valid
- Check all required fields present
- Copy from Firebase Console directly
"Authentication failed"
Cause: Invalid API key or project permissions
Solution:
- Verify API key is correct
- Check Firebase project permissions
- Regenerate API key if compromised
"Network error"
Cause: No internet connection or Firebase servers unreachable
Solution:
- Check internet connectivity
- Verify firewall settings
- Check Firebase status page
Security Best Practices
- Protect credentials: Don't commit config to public repos
- Use environment variables: Store sensitive data separately
- Firestore security rules: Implement proper access controls
- API key restrictions: Restrict keys in Firebase Console
- Regular rotation: Update credentials periodically
Advanced Configuration
Multiple Environments
Create separate firebase-config nodes for different environments:
firebase-config-dev: Development environmentfirebase-config-prod: Production environment
Switch configs based on deployment:
// In function node
const env = global.get("environment") || "dev";
msg.firebaseConfig = env === "prod" ? "firebase-config-prod" : "firebase-config-dev";
return msg;Custom Event Handling
// In a function node that accesses the config node
const firebaseNode = RED.nodes.getNode("firebase-config-id");
firebaseNode.on("datasets-updated", (payload) => {
node.warn(`Datasets updated: ${payload.datasetsCount} total`);
});
firebaseNode.on("firebase-connected", () => {
node.warn("Firebase connected successfully");
});Monitoring Connection Status
Visual Indicators
Nodes using Firebase config show connection status:
- Yellow dot: Connecting
- Green dot: Connected
- Red ring: Error
Programmatic Check
// Function node
const firebaseNode = RED.nodes.getNode("firebase-config-id");
if (firebaseNode.connectionState === "connected") {
msg.payload = "Firebase ready";
} else {
msg.payload = "Firebase not ready";
}
return msg;Troubleshooting
Connection takes long time
Possible causes:
- Slow network
- Large dataset/model lists
- Firebase service issues
Solutions:
- Check network speed
- Monitor Firebase console
- Wait for connection to complete
Frequent disconnections
Possible causes:
- Unstable network
- Firewall blocking connections
- Token expiration
Solutions:
- Check network stability
- Configure firewall to allow Firebase
- Verify credentials are valid
Data not syncing
Possible causes:
- Firestore security rules blocking access
- Permission issues
- Collection structure changed
Solutions:
- Review Firestore security rules
- Check user permissions
- Verify collection names
Required Firebase Services
The firebase-config node requires these Firebase services enabled:
- Firebase Authentication: User authentication
- Cloud Firestore: Database for datasets and models
- Cloud Storage: Image storage
- Firebase Realtime Database: Real-time updates (optional)
See Also
- Firebase Console
- Firebase Documentation
- Inferencer Node - Uses Firebase for models
- Dataset Upload Node - Uploads to Firebase Storage
- From Dataset Node - Streams images from Firebase
- List Dataset Node - Lists available datasets
- List Model Node - Lists available models
- OCR Inferencer Node - OCR inference with Firebase models
- Triton Inferencer Node - Triton inference with Firebase models
- Vision Platform Overview - Complete platform documentation