verida / data-connector-server

1 stars 2 forks source link

Fix search crashing when using calendar events search type #171

Closed aurelticot closed 2 weeks ago

aurelticot commented 2 weeks ago

When doing a search on endpoint /search/universal with a search type 'calendar', the server returns a 500 because of

[INFO] default - TypeError: Cannot read properties of undefined (reading 'indexFields')
    at DataService.<anonymous> (/Users/aurel/dev/verida/data-connector-server/dist/services/data.js:130:60)

Corresponding to this line:

https://github.com/verida/data-connector-server/blob/eddb5898b7a441987597c0efe161deefba67f76e/src/services/data.ts#L119-L120

Indeed, calendar is not in the schemas list:

https://github.com/verida/data-connector-server/blob/eddb5898b7a441987597c0efe161deefba67f76e/src/services/data.ts#L27-L58

I strongly rec ommend to strenghten the typing, so that such issue would be caught on static analysis.