cancel
Showing results for 
Search instead for 
Did you mean: 

SAP EventMesh Webhook Handshake Failed with CAP after some time

Andrew_Mai
Participant
0 Kudos
1,386

I have a problem when using SAP EventMesh with CAP. Sometime in the days, we saw that the app stop to process the event. The Queue number just keep increase, but none has been take. The only way is to restart the CAP service. We found that the Webhook said Handshake Failed. We tried to trace back the log of the CAP, but none errors log so far.

My question is, what can cause the Handshake Failed for the Event Mesh Webhook, and how to prevent it? We can't manually restart the CAP service all the time.

The CAP project is using @sap/cds version 6.4.0 (NodeJS 16)

Accepted Solutions (0)

Answers (1)

Answers (1)

Tobias_Griebe
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi andrew.mai.laidon,

when configuring the webhook on EM side, did you set the "Exempt Handshake" option to true? If not, you need to implement the handshake mechanism in your CAP app: https://help.sap.com/docs/SAP_EM/bf82e6b26456494cbdd197057c09979f/387a7e03feb24f6bb154ab1170e45eee.h...

Another option: can't your CAP app subsrcibe to Event Mesh for event consumption? So you don't have to push the messages to your app, but your app subscribes to the interesting events: https://cap.cloud.sap/docs/guides/messaging/#using-sap-event-mesh

Best regards,
Tobias

Andrew_Mai
Participant
0 Kudos

Hi tobias.griebe ,

For the EventMesh config, I just use the standard config:

"[production]": {"kind": "enterprise-messaging", "publishPrefix": "$namespace/", "subscribePrefix": "$namespace/", "format": "cloudevents", "queue": { "name": "$namespace/RequestorProcess" } }

But the handshake issues is happen randomly, and when I restart the CAP Service, it will run fine again. So is there any specific code in the @sap/cds lib that handle the handshake for the Webhook so I can take a look?

Tobias_Griebe
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi andrew.mai.laidon,

Unfortunately I'm not a CAP expert. Maybe david.kunz2 can comment on that.

Best regards,
Tobias

david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Per default, exemptHandshake is set to false, but you can overwrite this in your webhook configuration https://cap.cloud.sap/docs/node.js/messaging#sap-event-mesh-1

Andrew_Mai
Participant
0 Kudos

The link from the document: https://help.sap.com/doc/3dfdf81b17b744ea921ce7ad464d1bd7/Cloud/en-US/messagingrest-api-spec.html. But should I modify these additional properties? I still get this error randomly, quite frustrating for an enterprise service. But I have notice that it only happend when my site I have a high traffic.