Hello,
My data hooks were working perfectly, however, I noticed yesterday they just stopped working.
Please can someone have a look into this for me?
Kind regards,
BobFed12
Hello,
My data hooks were working perfectly, however, I noticed yesterday they just stopped working.
Please can someone have a look into this for me?
Kind regards,
BobFed12
FWIW data hooks have been inconsistent for quite some time. I had to completely stop using them because they would stop working out of nowhere. Also: there’s a bunch of things breaking on and off right now with wix websites.
What workaround are you using to fix your issue with them?
Mostly just writing scrips that handle what I need when a user adds something to a database. So for example I was trying to count database entries from a certain user after they insert a new item. It fails to find the newly created item(the one that triggered the afterInsert hook) randomly. Even just writing any code at all that triggers after a wix data insert promise has been resolved also fails randomly. After insert hooks and wix data insert promise returns fail 1-20% of the time. From what I can tell, the promise returns (or the hook executes) before the new item is actually finished being created. So if you tell it to .insert an item, and .then do something that involves that item, part of the time it won’t actually be able to find the item that it’s saying it created. Because of this behavior I started just doing everything “manually” to make sure my counts were correct.
It’s an odd situation because it will actually always return the id of the newly created item, and the item is actually created, eventually. But if you try to find that item in code, right after the promise tells you it was created and gives you the id, it won’t always find it. The way I’m currently getting around this issue is I have a set timeout that waits for two full seconds after the item was created before it tries to do anything with it. Giving it that two seconds has brought my failure rate down to 0.
It’s been brought up on these forums in the past, and they have acknowledged it before, but it doesn’t seem to be fixed yet.
Thank you for your reply!
It is definitely something they need to fix! As I can’t unfortunately manually do these calculations. And it worked 100% of the time, but now its not working even a small fraction of the time
Hopefully I’ll work out what it is. I’ve also started getting these random errors:
Access to fetch at ‘XXX’ from the origin ‘XXX’ has been blocked by CORS policy: The value of the ‘Access-Control-Allow-Origin’ header in the response must not be the wildcard ‘*’ when the request’s credentials mode is ‘include’.
if you happen to know anything about that?