Using Azure Function (NodeJS), was able to successfully send an event using EventGrid as output being, to an an Event Grid configured with input schema of type EventGridSchema,
However, errors are logged, when attempt of send a custom event is made using similar approach to another Event Grid configured with input schema of type CustomEventSchema.
Error logged is:
(Failed, Id=6b155f7d-0751-450a-9c6d-11aae4ac77c8, Duration=15171ms)This resource is configured for 'CustomInputEvent' schema and requires 'subject' property to be set. Report '03680905-5f77-45ab-97ee-817002d5536b:2:9/2/2021 1:04:27 PM (UTC)' to our forums for assistance or raise a support ticket.
The message being set to the output binding variable is as below. Even though the topic is configured to accept custom event with the following mapping
"requestId" -> "id" , "remediationId" -> "subject" and the fields "eventType" and "dataVersion" set to default values, I was forced to provide the fields in the response message (without with errors were returned).
context.bindings.responseMessage = {
id: "id",
subject: "subject",
eventType: "eventType",
dataVersion: 1,
data: {
remediationId: "remediationId",
requestId: "requestId",
status: "status"
}
};
The corresponding bindings JSON snippet is pasted below
{
"type": "eventGrid",
"name": "responseMessage",
"topicEndpointUri": "RESPONSE_TOPIC_EP",
"topicKeySetting": "RESPONSE_TOPIC_KEY",
"direction": "out"
}
Please let me know if custom events are not supported by EventGrid when used as output binding. If so, is there a specific format that needs to be used to send the data, which can help resolve the error returned.
A related observation, was that the actual Event sending over the output binding, seems to happen after the function execution is completed, and there seems to be no way to wait for the sending to be complete, and then signal the end of function execution. Please advice is there is any way to achieve this.
