Help

Common Problems with Firebase

Last updated:

Creating a Firestore Structured Query for a Trigger

When using a Zap to trigger on new documents within a Firestore collection, it's important to build a Structured Query that returns the selected documents in the correct order, otherwise your Zap may never see the new documents.

The orderBy property in your query needs to ensure that the new documents are at the "top" of the search results, so that the Zap can see those documents. In most cases, you'll want to use DESCENDING, like this:

    "orderBy": [{
        "field": {
            "fieldPath": "someKeyOfYourChoice"
        },
        "direction": "DESCENDING"
    }]

If your field has spaces in it, you will need to surround it with backticks. For example:

    "orderBy": [{
        "field": {
            "fieldPath": "`a field with spaces`"
        },
        "direction": "DESCENDING"
    }]

You can learn more about the correct syntax/structure here: https://cloud.google.com/firestore/docs/reference/rest/v1beta1/StructuredQuery#Order

Creating a Firestore Structured Query for a Search

When using a Zap to search for a specific document within a Firestore collection, it's important to build a Structured Query that contains the appropriate where clause, like this:

    "where": {
        "fieldFilter": {
            "field": {
                "fieldPath": "whenPlayed"
            },
            "op": "EQUAL",
            "value": {
                "stringValue": "some-compare-to-value"
            }
        }
    }

In your Zap, the "compare to" value is probably something that you'll want to connect with a previous step within your Zap, using the "plus" button on the right-hand side of the input field within the Zap Editor.

You can learn more about the correct syntax/structure here: https://cloud.google.com/firestore/docs/reference/rest/v1beta1/StructuredQuery#Filter

Invalid data error (Couldn't parse JSON object)

Sometimes you will see an error that says "Invalid data; couldn't parse JSON object, array, or value. Perhaps you're using invalid characters in your key names."

This error occurs when the fields you are trying to send to Firebase contain invalid characters. Firebase prohibits key names from containing:

  • . (period)
  • $ (dollar sign)
  • [ (left square bracket)
  • ] (right square bracket)
  • (hash or pound sign)

  • / (forward slash)

To get around the error, you will need to manually assign names to the keys. See the Customizing Fields to Store section for details.

My Firebase Zap isn't triggering when I add new records

New records need to appear at the end of your data for this to work. If you aren't using push IDs, your records need to be ordered lexicographically or by priority so that new records appear last.

A simple way to accomplish this is by calling setWithPriority and using Firebase.ServerValue.TIMESTAMP to order by timestamp.

Error: Empty key in "Path to data". Probably tried to use a field which was empty as part of the path

Make sure you remove the beginning and ending / from the Path field.

For example, /customers/new/ becomes customers/new.

I'm getting "Firebase paths/keys cannot contain the characters $ # . [ ]" but there are no invalid characters included in the path/keys

Users sometimes encounter this error if anything that is being supplied in the value has a pipe ( | ) character in it. For example:

pipe in value

This has to due with the way our system encodes key/value pairs. The recommend solution is to not include invalid characters in the value that is included or use a Formatter step to remove the characters.


Need More Help?

Contact Support

Tell us about your problem, and we’ll find you a solution or you can email support.
Get Help

Hire an Expert

We have a directory of professionals across the globe who are ready to help.
Find a Zapier Expert

Zapier Community

Connect with other Zapier users and industry professionals to get help crafting the perfect workflow.
Check out the community