Add multi context to an event

I have multi product_context and want add it to an event (my app is react app, and i using Browser Tracker in Javascipt Tracker). My code below:

		const contextArray = []; (element, index) => {
			var category = await this.props.productActions.getNameCategoryByID(element.id_category)
			var publisher = await this.props.productActions.getNamePubliserByID(element.id_nsx)
			var author = await this.props.productActions.getNameAuthorByID(element.id_author)

			const product_context = {
				schema: "iglu:com.bookshop/product_context/jsonschema/1-0-0",
				data: {
					product_id: element._id,
					quantity: parseInt(element.count),
					price: element.price,


			event: {
				schema: 'iglu:com.bookshop/product_action/jsonschema/1-0-0',
				data: {
					action: "purchase"
			context: contextArray

But it not working. I can help me!!

Hi @Phu_Dinh,

It seems that you are using an async function within the that awaits for some other async functions to populate the category, publisher and author. Since the content of the map is executed asynchronously, the contextArray list does not get populated before the trackSelfDescribingEvent is called (i.e., at the time the event is tracked, the list does not yet have the context entities added).

You might find some suggestions how to await for the results of the map call in this thread.