Skip to content

Firebase Connector

The Firebase connector enables writing data to Google Cloud Firestore, a flexible, scalable NoSQL cloud database for mobile, web, and server development.

Connector Types:

  • FirebaseWriter - Write documents to Firestore collections

Write data to a Firestore collection:

{
"type": "FirebaseWriter",
"config": {
"credentialsFile": {
"mode": "base64",
"data": "<base64-encoded-service-account-json>"
},
"projectId": "my-firebase-project",
"collection": "sensor_readings"
}
}

Connect to a specific Firestore database (for multi-database projects):

{
"type": "FirebaseWriter",
"config": {
"credentialsFile": {
"mode": "path",
"data": "/path/to/service-account.json"
},
"projectId": "my-firebase-project",
"databaseName": "production-db",
"collection": "iot_events"
}
}
ParameterTypeRequiredDescription
credentialsFileEncodedFileService account credentials file
projectIdstringFirebase/GCP project ID
collectionstringFirestore collection name
databaseNamestringFirestore database name (for multi-database projects)

The credentialsFile parameter supports two modes:

{
"credentialsFile": {
"mode": "base64",
"data": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50Ii..."
}
}
{
"credentialsFile": {
"mode": "path",
"data": "/etc/meddle/firebase-credentials.json"
}
}
  1. Go to Firebase Console
  2. Select your project → Project Settings → Service Accounts
  3. Click “Generate new private key”
  4. Download the JSON file
  5. Use the file path or base64-encode the contents

Each data payload is added as a new document in the specified collection:

{
"temperature": 25.5,
"pressure": 101.3,
"humidity": 60,
"timestamp": 1234567890
}

Firestore automatically generates a unique document ID for each entry.

Store sensor readings in Firestore:

{
"type": "FirebaseWriter",
"config": {
"credentialsFile": {
"mode": "path",
"data": "/config/firebase-sa.json"
},
"projectId": "iot-monitoring",
"collection": "sensor_data"
}
}

Log system events to Firestore:

{
"type": "FirebaseWriter",
"config": {
"credentialsFile": {
"mode": "base64",
"data": "<credentials>"
},
"projectId": "event-tracker",
"collection": "system_events"
}
}

Write to a specific database in a multi-database project:

{
"type": "FirebaseWriter",
"config": {
"credentialsFile": {
"mode": "path",
"data": "/config/firebase-sa.json"
},
"projectId": "enterprise-app",
"databaseName": "analytics-db",
"collection": "metrics"
}
}

Solutions:

  • Verify credentials file is valid JSON
  • Check project ID matches your Firebase project
  • Ensure service account has Firestore permissions
  • Verify base64 encoding if using base64 mode

Solutions:

  • Check collection name is valid
  • Verify Firestore security rules allow writes
  • Ensure service account has datastore.user role
  • Check Firestore quotas and limits

Solutions:

  • Verify network connectivity to Google Cloud
  • Check firewall allows outbound HTTPS (port 443)
  • Ensure credentials haven’t expired or been revoked
  1. Use Service Accounts: Never use user credentials in production
  2. Limit Permissions: Grant only necessary Firestore permissions
  3. Organize Collections: Use meaningful collection names with clear hierarchy
  4. Monitor Usage: Track Firestore read/write operations for cost management
  5. Secure Credentials: Store credentials securely, never commit to version control
  • MongoDB - Alternative NoSQL database
  • SQL - Relational database storage
  • InfluxDB - Time-series database