Open rsun11 opened 7 months ago
@rsun11 if you have the time to create a PR, I can review it. I am going to do some investigation on this.
Tried deploying the same code to a gen 2 trigger but the database context is referencing the default database so “exists” property always returned false and calls to the named database throws an exception.
@rsun11 can you share your configuration? the Firebase team has not heard of this issue so they are wondering if the extension was misconfigured.
entered:
Tried again this morning and the same issue is happening...
Finally got the trigger to work with:
export const executeIndexOperation = onDocumentWritten( { document: 'documents/{documentId}', database: DATABASEID, region: REGION, }, async (change): Promise<void> => {
but this only works when deployed using the firebase cli.
Also, executeFullIndexOperation wasn't working with a named database. The query would always return results from the default database. Had to update to:
"firebase-admin": "^12.0.0",
"firebase-functions": "^4.8.2",
for it to start working again.
hey @rsun11 I am going through the updates you mentioned here. I am also talking to the Firebase team which seems surprised that I had this working in gen1 before some update that broke it. will let you know what happens.
One thing to try would be to deploy the current code as a gen 2 trigger but with the firebase package updates from above.
hey @rsun11
I tried implementing you suggestions. using the CLI deploy the update code, fails with this error message:
- update firestore-algolia-search-s4eg
; RESOURCE_ERROR at /deployments/firebase-ext-firestore-algolia-search-s4eg/resources/executeIndexOperation: {"ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions","ResourceErrorCode":"400","ResourceErrorMessage":"Cannot create Firestore trigger for projects/algolia-store/databases/test. Triggers must be created with a \"(default)\" Firestore Native database. See https://firebase.google.com/docs/firestore/extend-with-functions#limitations."}
What steps did you take to implement gen2 versions for the extension.
If you change the function to
export const executeIndexOperation = onDocumentWritten( { document: 'documents/{documentId}', database: DATABASEID, region: REGION, }, async (change): Promise<void> => {
the deployment will detect the signature as gen 2. I don’t think DatabaseId, document path, and region could not be stored as environment variables since the deployment needs those values populated during deployment to create the trigger.
hey @rsun11 I am working with the firebase team to see if we can get this resolved. No eta at the moment.
hey @rsun11 is this still an issue?
Not sure. I've deployed the code manually through the cli so haven't used the extension in a while.
On Wed, May 8, 2024 at 2:36 PM Sajid Momin @.***> wrote:
hey @rsun11 https://github.com/rsun11 is this still an issue?
— Reply to this email directly, view it on GitHub https://github.com/algolia/firestore-algolia-search/issues/204#issuecomment-2101521480, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPFPW6CDHKUYVNT7ZKKW3LZBKLG5AVCNFSM6AAAAABFNQUI7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBRGUZDCNBYGA . You are receiving this because you were mentioned.Message ID: @.***>
Update: Firebase team has mentioned that they will be support named database to be configured with the Firebase extension. Once they do officially support it, I will take a look at it.
Just checking in to state that this IS still an issue. I have named databases configured in my algolia extensions (3 of them, dev, stage, and prod). We recently moved to named DBs in firestore, and Algolia is very unreliable about reading the documents from them. I consistently see logs of it attempting to read from the default DB instead of the named DB.
Error when performing Algolia index Error: 3 INVALID_ARGUMENT: The request was for database 'projects/project-id-here/databases/(default)' but was attempting to access database 'projects/project-id-here/databases/development'
Just checking in to state that this IS still an issue. I have named databases configured in my algolia extensions (3 of them, dev, stage, and prod). We recently moved to named DBs in firestore, and Algolia is very unreliable about reading the documents from them. I consistently see logs of it attempting to read from the default DB instead of the named DB.
Error when performing Algolia index Error: 3 INVALID_ARGUMENT: The request was for database 'projects/project-id-here/databases/(default)' but was attempting to access database 'projects/project-id-here/databases/development'
I was also receiving this error. I realized setting the Force Data Sync to 'No' does mitigate the issue. Still a problem with the extension but a descent workaround.
My guess is that an update was made last night in Firebase Cloud Functions to not allow Gen 1 triggers on a named firestore database.
So this line in extension.yaml doesn't seem to be supported anymore.
The fix looks to be a conversion to a gen 2 trigger: #169