[NOT_REPRODUCIBLE] Cannot delete record from algolia using rules

Hi Sebastian,

I have successfully configured two Algolia rules for two different schemas.

Now, I would like to delete the record in my Algolia index whenever I DELETED or UNPUBLISHED a page in Squidex. How can I do this?

I’ve tried specifying the following under Schemas:

event.type == 'Published' || event.type == 'Updated' || event.type == 'Unpublished' || event.type == 'Deleted'

And the following under “Deletion”:

The above configuration gives me the following error:

{"message":"null value not allowed outside of body near line:1 column:46","status":400}

Error: {"message":"null value not allowed outside of body near line:1 column:46","status":400}

Elapsed 00:00:00.0590000.

Thanks!

This should actually be correct. I have no idea what the exception means.

This is the code. Could be a bug or so, I need to investigate that.

It was a small bug. I have fixed, but not deployed it yet.

Cool that you found the bug :+1:
Please do let me know when it’s deployed so that I can configure my rules again and try it out.
Thanks!

1 Like

Finally deployed. Sorry, it took very long.

1 Like

Thanks! Will try it out as soon as I have some time over… currently working on some other things :slight_smile:

1 Like

Hi Sebastian,

I tested this today (I’m using Squidex Cloud) and I’m still getting the following error:

{"message":"null value not allowed outside of body near line:1 column:46","status":400}

Error: {"message":"null value not allowed outside of body near line:1 column:46","status":400}

Elapsed 00:00:00.0150000.

Weird. I will have another look early next week.

1 Like

Hi Sebastian, just wondering if you’ve had time to look into this?

Hi Sebastian, I’m currently working on a “Reviews” section/feature that will require review schema items to be deleted automatically by the system (Squidex) when a user decides to delete her review from within my web app. The deletion will in turn trigger an Algolia “Delete” action that deletes the review record from the Algolia index. For my other schemas I have been able to get around the error message above by manually deleting the record from Algolia. This is fine because those schemas do not change that regularly and are not as critical to the user’s own interactions in my app. Review items are more critical however. So what I’m wondering is if you’ve had some time to investigate further? And if you need some help in reproducing it or something else just let med know! Thanks!

Hi,
I was just so busy with the Entity framework stuff, that I have forgotten it. I am planing to fix another bug today, then I can do that together.

I have just tested it locally and it works fine. We can debug it together if you want.

No worries, Sebastian. Yes, we can do that. I’m about to delete some records/content items from Squidex… will test and come back with results.

Okay, I deleted a review content item and I get this in the logs:

{"message":"null value not allowed outside of body near line:1 column:46","status":400}

Error: {"message":"null value not allowed outside of body near line:1 column:46","status":400}

Elapsed 00:00:00.0660000.

I have this in the “Deletion” field:

event.type == 'Unpublished' || event.type == 'Deleted'

What happens without this “Deletion field”?

Without the “Deletion” field I get the following:

{"message":"null value not allowed outside of body near line:1 column:46","status":400}

Error: {"message":"null value not allowed outside of body near line:1 column:46","status":400}

Elapsed 00:00:00.0770000.

It seems it tries to delete the review from the index eventhough I have not specified: event.type == 'Unpublished' || event.type == 'Deleted'

Okay, weird … It was working for me.

By default it uses the event type to determine whe nsomething should be deleted.

Okay, maybe I need to recreate the rule or something after the changes?

Not, not really. Old jobs might still be invalid, but new changes should work. I can have a look again or if you wantto provide a PR it would also be appreciated.

Still not reproducible locally. You are using self hosting, right?