Firebase Firestore icon

Firebase Firestore

Manage documents in Google Cloud Firestore

Overview

This node integrates with Google Cloud Firestore, allowing users to manage documents within Firestore databases. Specifically, the Read operation fetches a document from Firestore based on a specified path.

Common scenarios where this node is beneficial include:

  • Retrieving configuration or user data stored in Firestore for use in workflows.
  • Accessing specific documents by their path to trigger conditional logic or further processing.
  • Integrating Firestore data retrieval into automation pipelines without writing custom code.

For example, you might use this node to read a user's profile document from Firestore by specifying the path users/{userId}, then use that data downstream in your workflow.

Properties

Name Meaning
Path The Firestore path to the document to read. This should be the full path including collection and document ID, e.g., collectionName/documentId.

Output

The output JSON object contains the fields of the retrieved Firestore document along with two additional metadata fields:

  • id: The document ID.
  • path: The full Firestore path of the document.

If the document does not exist, the output JSON will contain:

  • success: false
  • reason: "Document not found"
  • path: The requested document path.

Example successful output:

{
  "id": "abc123",
  "path": "collectionName/abc123",
  "field1": "value1",
  "field2": 42,
  ...
}

Example when document is missing:

{
  "success": false,
  "reason": "Document not found",
  "path": "collectionName/missingDoc"
}

This node does not output binary data.

Dependencies

  • Requires a valid Google Cloud Firestore service account credential configured in n8n.
  • The service account must have permissions to read documents from the specified Firestore database.
  • The node uses the official Firebase Admin SDK internally to interact with Firestore.

Troubleshooting

  • Invalid JSON format in Data field: Although this applies mainly to create/update operations, ensure any JSON input is correctly formatted if you extend usage.
  • Document not found: If the output indicates the document was not found, verify the Path property is correct and the document exists in Firestore.
  • Permission errors: Ensure the provided service account has sufficient Firestore read permissions.
  • Invalid path format: The path must point to a document (not just a collection). Paths with an odd number of segments are considered collections; even number segments indicate documents.
  • General Firestore errors: Errors from Firestore are wrapped and reported with the prefix Firestore Error:. Check the error message for details.

Links and References

Discussion