Instance not found even though instance exists and unique rule being ignored

Hi @aprilmintacpineda . The short answer is that there can be a delay between creating an Index (and active is set to true) and the index being recognized to be written. We have an update ready for release that will ensure that there is never such a delay.

long answer

Fauna implements a cache of your schema in order to keep requests performant. Each replica node has it’s own cache. There can be a slight delay between creating your Index and all of the replica nodes’ caches being updated. Additionally, some of the nodes may be updated sooner, including the one that created the Index.

What this means is that, depending on how your requests are routed, some requests may go to nodes that are not yet aware of your new Index. Therefore an entry would not be written to the new Index.

Also note that if the Index is not being written to, it cannot enforce uniqueness constraints. This is why you were able to create two documents with matching terms.

The index build process will ensure that all existing data is included in the Index. The issue here is that some requests may go to nodes that don’t recognize the index exists yet. If the index finishes building (even with the existing data) quickly, there can still be a slight delay for future requests to write to the index.

Transactional schema cache coming soon

I already said that we have an update ready for release that will ensure that there is never such a delay. The update will ensure that once an Index is created (and active!) it will be immediately available to all future requests.

We will provide an update when it is deployed. It just needs to finish going through the QA process.

In the meantime

The issue is intermittent due to a variety of factors. If you are having this problem, we recommend:

  • Deleting the offending Index
  • Recreating the Index
  • Wait at least 5 minutes to add any Documents to the source Collection(s).
1 Like