Hey peeps! Odd one I'm encountering that I haven't...
# community-help
n
Hey peeps! Odd one I'm encountering that I haven't been able to replicate on my local typesense vs production. For a handful of document updates in a large data set, I'm getting a 400
Field <fieldname> must be an array.
. As far as I can tell, an array with values is always being sent through in my payload. The field is not set to optional, but passing empty arrays seems to work locally. The schema definition from the cluster is:
Copy code
{
      "facet": true,
      "index": true,
      "infix": false,
      "locale": "<foreign locale>",
      "name": "fieldname",
      "optional": false,
      "sort": false,
      "stem": false,
      "stem_dictionary": "",
      "store": true,
      "type": "string[]"
    },
This is only happening for a small subset of data, and again from inspecting what should be sent through, there definitely is data inside of the field array being passed through.
For ref: Using Laravel, but not Scout, though a similar idea in implementation. I suspected that if I had any errant
unset
calls and the indexes were wrong it might cause some weird problem on the typesense side, but checking all the occurrences of the error I'm seeing this for both modified arrays that might have skipped indexes, and unmodified arrays (and again this doesn't seem to cause a problem locally). Same typesense version between local and the cloud cluster (29)
f
This sounds like a client side problem. Can you log out the payload being sent? Also, are the schemas identical between environments?
n
Yeah, busy with the logging side of things currently (got some external delays right now). Doing this update from a queued job and from the job analytics I can see the payload being passed in there (that is morphed into the document payload for the request) seems correct. As for the schema, yeah looks the same - top is what I've pulled from production, bottom is from local
Have also copied the model payload data from the failing instance on prod and put it in my local model, no problem with it there
f
Could you DM me your cluster id and the document data?
👀 1
n
Visibility for anyone coming across this thread: Seems indeed that having an array with missing indexes via
unset
seems to cause this. Be sure to look at that first!