Open filipnathanel opened 1 year ago
For anyone hitting against the same problem, changing the projection fixed it for me:
{
"transactionId": _rev,
"projectId": sanity::projectId(),
"dataset": sanity::dataset(),
"ids": {
"created":
select(
before() == null && after() != null => [_id],
before() != null || after() == null => []
),
"deleted":
select(
before() != null && after() == null => [_id],
before() == null || after() != null => []
),
"updated":
select(
before() != null && after() != null => [_id],
before() == null || after() == null => []
),
"all": [
_id
]
}
}
For anyone hitting against the same problem, changing the projection fixed it for me:
{ "transactionId": _rev, "projectId": sanity::projectId(), "dataset": sanity::dataset(), "ids": { "created": select( before() == null && after() != null => [_id], before() != null || after() == null => [] ), "deleted": select( before() != null && after() == null => [_id], before() == null || after() != null => [] ), "updated": select( before() != null && after() != null => [_id], before() == null || after() == null => [] ), "all": [ _id ] } }
Had the same problem and this works. Thank you!
For anyone hitting against the same problem, changing the projection fixed it for me:
{ "transactionId": _rev, "projectId": sanity::projectId(), "dataset": sanity::dataset(), "ids": { "created": select( before() == null && after() != null => [_id], before() != null || after() == null => [] ), "deleted": select( before() != null && after() == null => [_id], before() == null || after() != null => [] ), "updated": select( before() != null && after() != null => [_id], before() == null || after() == null => [] ), "all": [ _id ] } }
Had the same problem and this works. Thank you!
I'm running into the same issue and I've updated the Projection settings in the webhook config.
This is the content that my endpoint is receiving, so it seems that it should have an ID to work with?
req.body {
transactionId: 'TUi1yDXwDXw7DHV1cKifdQ',
projectId: 'xxxxxx',
dataset: 'production',
ids: {
all: [ '604aa1d1-75a6-43cb-ad9b-c8ab459d4945' ],
created: [ '604aa1d1-75a6-43cb-ad9b-c8ab459d4945' ],
deleted: [ null ],
updated: [ null ]
}
}
I had to delete the old webhook and add a new one with the updated projection, for some reason just updating the webhook didn't work for some reason. Hope this helps.
Thank you @filipnathanel for the solution.
Created a new webhook (!!MUST!!) as per @davidy3k (thanks man) and added the query provided by @filipnathanel and it worked for me.
@runeb Time to update the docs / webhook share link?
Hi There, I am setting up a sanity -> algolia sync with the help of your package.
I am experiencing the following problem:
Given the following hook transformation (identical as in the readme)
the webhook sends following data to my endpoint:
Please note the
In such case the library will try to create delete entry on Algolia side with the
objectID
ofnull
Which in turn will result in ApiError:
When I am emulating the webhook data without the
null
entries in thecreated
anddeleted
everything works just fine.