charlie
charlie14mo ago

"Field '_bRK...' starts with an underscore, which is not allowed for nested fields"

Hey team, I'm getting this error in a webhook (my Convex HTTP action) which looks up a document from an external database to copy it into Convex. The document in question has a field "events" which is a POJO mapping event IDs to events. One of the event IDs (generated by nanoid on the client side) apparently started with an underscore, which is causing Convex to reject the db.patch in the mutation called by my HTTP action, causing the webhook to return a failure code (because of my try/catch) and enter an infinite retry loop. However, "events" is typed in my schema as v.any() , so why does it matter what its keys are? Is this intended behavior?
2 Replies
ballingt
ballingt14mo ago
Hi Charlie, yup this is intended, but something that might be relaxed in the future. For now to deal with arbitrary data you'll need to stick it in a string. (JSON.stringify etc) Underneath the v.any()-style validation, Convex allows arbitrary Convex values in the DB. These don't quite include all of json.
charlie
charlieOP14mo ago
gotcha, I will move to a custom alphabet for nanoid then! Thanks Tom!