Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Firestore: error 0 when creating a Unique Field Index

Hello, I'm trying to create an unique field index for a collection group in Firebase Firestore.

I want to be able to find a specific transaction in the "Transacciones" collection group, based of its "token", which is a code provided by the payment platform.

When trying to create such index the following error appears:

 

 

0:

 

 

Image of the error:

Gustavo11_0-1738009433889.png 

(message says the index cannot be created right now, and to check the error message)

About the index I'm trying to create:

  • Collection ID: Transacciones
  • Field route: datosWebpay.token
  • Order: asc
  • Type: collection group

Anyone knows what could be wrong?

 

0 2 342
2 REPLIES 2

Hi @Gustavo11,

Welcome to Google Cloud Community!

It seems that the issue you're encountering may be due to a conflict or limitation in the index creation process in Firestore. This could happen if there is an existing index that conflicts with the fields you are attempting to index or if multiple index changes are being attempted at once.

Here are some steps you may try to resolve this:

  • Check for Existing Indexes: Head to the Firebase Console or Google Console and review the existing indexes for your "Transacciones" collection group. If there’s already an index for the fields you need, you might not need to create a new one.
  • Collection Group Queries: If no index has been created you might want to check this post on how to create indexes in Collection Group Queries and retry creating the index.
  • Create the Composite Index Manually: If no conflicting index exists, try manually creating a composite index in Firestore for the fields you’re querying.
  • Review Firestore Quotas: Ensure that you're within the limits for index creation. Exceeding Firestore's quotas (such as the number of indexes) could cause these issues.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Sorry for the late reply, but after a while I found the cause of the issue and is not due to limitations or quotas... there is something wrong with my browser session. For some reason (and with that project only), I could not do any action in the Firebase Console without resulting in an error. The solution I found was to log from an incognito tab and it worked. Not an ideal solution. I deleted all of the browser's data to see if that would fix the problem with no luck. Not sure how else I could fix this issue more than always using incognito.