All questions

Requests started failing after we enriched context attributes with a big object

Asked by Leandro Paes on

LPLeandro Paes

We run a marketplace and started passing our product object as context attributes so audiences could target by category, seller, price range, etc. Worked at first. After the catalog team added more fields to the product payload, requests began getting rejected.

I removed fields one by one until it worked again, so clearly there is a size or entry limit somewhere, but I could not find the actual numbers. What are the real payload limits for context attributes? Trial and error is not how I want to document this for the team

Was this helpful?

1 answer

RORenata OkonkwoAccepted answer

The limits you were reverse-engineering: context attributes accept at most 30 entries, nested at most 5 levels deep. Your growing product object crossed the entry cap once the catalog team expanded it.

The design intent is worth internalizing here: attributes are not a payload channel, they are evaluation inputs. The only fields worth sending are the ones your audience conditions actually reference. A CQL condition like

context's category is "electronics" and context's price is less than 500

needs two attributes, not the forty-field product document. So instead of serializing the domain object, map it down:

croct.fetch('product-hero@1', {    attributes: {        category: product.category,        seller: product.seller.type,        price: product.price,    },});

One related distinction so you do not hit the neighboring wall: eventMetadata is a separate mechanism with its own cap of 5 entries. Neither is meant to carry full domain objects, and both stay comfortably under their limits once you send only what audiences query.

Was this helpful?
Still have questions?