Need Help ASAP- Database Collection not loading

Hi,
I have created a collection to store user input from a form. And I have connected this data to a repeater.
Everything was working fine until a few hours ago, since when I am only getting this error message and no data shows up in the repeater either.
Also, it seems to have automatically added 2 items from I don’t know where.

I have tried restoring site to a previous version as well, but no resolution.

Hi,
Can you please send us the site URL so that we can have a look?

Thanks,
Tal.

Hi Tal,
Im not sure what link you require.

  1. Site address: moneyplanned.com
  2. Editor dashboard address: https://www.wix.com/dashboard/3b932ec2-da72-45b7-adae-b2c247d5fe72/home
    3.Database address: https://www.wix.com/dashboard/3b932ec2-da72-45b7-adae-b2c247d5fe72/database/User-Goals

Thanks,
Sameer

Hi,
I was able to recreate the issue on my end. I’ve forwarded it to the relevant team. I’ll get back to you as soon as I have any update.

Sorry for the inconvenience,
Tal.

Hi Sameer,

You have a AfterQuery hook for User_Goals collection, which tries to access item.goalCategory. In your collection there are a few items which have undefined value for goalCategory property. You need to fix the items or improve your hook code not to fail if goalCategory is undefined.

Item ids without goalCategory:
f86fffea-75bf-47d6-8c99-b0ead6417aa5
01e131ad-49cc-4cc9-87b9-32db57f9eb8f

Hi Egidijus,
Thanks for the response. Im not sure how to fix the items when i cant access the live data.
The items in the collection are not important and its ok to completely clear all items also.
Can you help me to fix this collection?
Also, can you please help me with the code required to make sure the hook AfterQuery does not.
Thanks,
Sameer

Sameer,

one of the approaches to quick-fix current data:

  1. disable your hook temporarily (by renaming hook name, for example)
  2. copy your Live data to Sandbox (in Editor, open collection, click Sync > Overwrite this collection from Live)
  3. fix the data by adding missing properties
  4. sync back to Live (in Editor, open collection, click Sync > Copy all items to Live)

However, if your collection happens to receive similar data in the future, it’s best to make your hook code more robust by handling these cases.

First of all, you should fix the access to goalCategory from

if(item.goalCategory.includes("Insurance"))

to

if(item.goalCategory && item.goalCategory.includes("Insurance"))

I also noticed, that some other property is missing (item.goalDate), thus still breaking hook code.
Depending on your app logic, you could set a default value for item.goalDate or not process such item at all.

Thanks Egidijus,
Ill try this and let you know :slight_smile:

Thanks a lot Egidijus, I disabled the hook and cleaned the data. I got it working, now I just need to fix up the code