algolia / firestore-algolia-search

Apache License 2.0
108 stars 33 forks source link

Subcollections fail the initial sync #175

Closed pardis-shah closed 9 months ago

pardis-shah commented 11 months ago

I have 3 extensions setup, 2 for normal collections and one for a subcollection inside one of those collections.

  1. lists
  2. users
  3. lists/{listID}/Items

the first 2 work as expected, they synced initially and every new record gets indexed smoothly. but the subcollection one is always failing the initial sync. I tried different syntaxes like lists/{listID}/Items, lists/{id}/Items and lists/{list_id}/Items.

I saw an issue that was reported before and got fixed in 1.1.3, but I am using 1.1.3 and still have this issue.

here's my config:

image Screenshot 2023-07-12 at 2 19 56 PM

but none of them work. I always get this error in my logs, but not sure if it's related:

{
  "textPayload": "Function execution took 816 ms, finished with status: 'error'",
}
{
  "textPayload": "{\"name\":\"ApiError\",\"message\":\"Error: Unhandled error\\n   
 at entryFromArgs (/workspace/node_modules/firebase-functions/lib/logger/index.js:130:19)\\n    
at Object.error (/workspace/node_modules/firebase-functions/lib/logger/index.js:116:11)\\n    
at /workspace/node_modules/firebase-functions/lib/common/providers/tasks.js:70:24\\n    
at runMicrotasks (<anonymous>)\\n    
at processTicksAndRejections (node:internal/process/task_queues:96:5)\",\"status\":400,\"transporterStackTrace\":[{\"request\":{\"data\":\"{\\\"requests\\\":[{\\\"action\\\":\\\"addObject\\\",\\\"body\\\":{\\\"listId\\\":\\\"000F0380-0C5F-44C8-86A6-EAE4BC5DF009\\\",\\\"summary\\\":\\\"samplesummary\\\",\\\"imageUrl\\\":\\\"https://secure.img1-
…
smomin commented 11 months ago

Can you try lists/{parentId}/Items? Also, can you take a snapshot of the data with the Items as a collection?

smomin commented 11 months ago

Has this issue been resolved?

pardis-shah commented 11 months ago

@smomin so sorry for the late response. I did try lists/{parentId}/Items as well, same results.

Screenshot 2023-07-23 at 12 42 00 AM

here's a sample data from the collection:

{
    "views": 15,
    "imageURL": "",
    "categories": [
        ""
    ],
    "visibilityLevel": "public",
    "owner": "",
    "listDescription": "",
    "id": "",
    "numberOfItems": 1,
    "likes": 0,
    "name": "",
    "items": [
        {
            "imageUrl": "",
            "listId": "",
            "id": "",
            "summary": "samplesummary",
            "views": 0,
            "author": ""
        }
    ]
}
smomin commented 11 months ago

Thanks. I will check on this and get back to you soon as I can.

smomin commented 11 months ago

I have tested the extension and the full indexing works without any issues. You might want to check the API key if you are still having problems.

pardis-shah commented 11 months ago

I have! I have 2 more extensions running just fine with the same API Key, the only difference is that the other ones are top level collections, and this one is a sub collection

smomin commented 10 months ago

Here is my current setup: I have a collection of movies and each movie has a sub-collection of actors. I have installed two extensions one for movies and another for actors. With this set up, I was able to execute a full index on both collection and sub collection.

Screenshot 2023-08-13 at 11 05 46 PM
smomin commented 9 months ago

I am closing this issue since I have not heard back. Please reopen if problem persists.

vivekraj commented 8 months ago

The issue still persist on 1.1.3. Also tried adding two extensions, one for the parent and one for the sub collection. (As explained on https://github.com/algolia/firestore-algolia-search/issues/56#issuecomment-905926093) Tried pointing to the same index and different indexes as well. But it still fails the sync.

vivekraj commented 8 months ago

The issue still persist on 1.1.3. Also tried adding two extensions, one for the parent and one for the sub collection. (As explained on #56 (comment)) Tried pointing to the same index and different indexes as well. But it still fails the sync.

Figured it out. The API key didn't had access to the sub collection's aloglia index