on 09-16-2021 9:03 PM
Hello fellow devs,
right now we are trying to build an BTP scenario, including Event Mesh, CAP, and HANA Cloud.
The CAP App is working and is correctly creating the queues and topics in the Event Mesh Service. A Webhook is also created, but this is basically where the problem lies.
The webhook is getting created with the URL "https:<appname>-app.cfapps.eu10.hana.ondemand.com/messaging/enterprise". Unfortunately the handshake isnt working at all.
The Url-path "/messaging/enterprise" seems strange to me, but in the source files i saw that its generated by default. So i guess CAP should somehow be able to react to request on this path. (?)
Shouldn't CAP be able to react to the options-request (webhook-request) by itself? I also tried to create a webhook manuelly, where i can exempt the handshake. Unfortunately the communcation is still not working. In the event mesh cockpit i can see a reason for the communication not being successful:
I do not have any authentication infront of my service or CAP application. What i did to recieve the event is the following:
const messaging = await cds.connect.to('messaging');
<br> messaging.on('<topic-name>', async msg => {
let message = JSON.stringify(msg);
console.log(message)
})
The configuration in my package.json should be correct. If it weren't i shouldnt be able to connect to event mesh and the queues, topics and webhooks shouldnt be created.
I can also see, that the queue is filling when im calling then function i provided for emitting the event. So this part is working aswell.
Am i missing something? Do i have to provide a custom server to recieve the events? Or does it maybe has something todo with the deprecated "dev"-serviceplan of the BTP Trial event mesh service?
The App is deployed on a BTP Trial CF. Im using the App as the sender and receiver.
Thanks in advance!
Daniel
Hi Daniel,
Thanks for clarifying. Yes, it seems to be an authorization problem. Did you bind your application to XSUAA? If yes, then you must grant the necessary scope to tokens generated by the XSUAA instance of Event Mesh.
So you need this scope in your settings for your own XSUAA:
{
...,
"scopes": [
...,
{
"name": "$XSAPPNAME.emcallback",
"description": "Event Mesh Callback Access",
"grant-as-authority-to-apps": [
"$XSSERVICENAME(<SERVICE_NAME_OF_YOUR_EVENT_MESH_INSTANCE>)"
]
}
]
}
and in the service descriptor of Event Mesh you need to add the following:
{...,"authorities":["$ACCEPT_GRANTED_AUTHORITIES"]}
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi david.kunz2,
i added the scope for the xsuaa. The xs-security.json in its current state:
{
"xsappname": "p36/gxp/poc/receiver",
"tenant-mode": "dedicated",
"scopes": [
{
"name": "$XSAPPNAME.emUser",
"description": "emUser"
},
{
"name": "$XSAPPNAME.emcallback",
"description": "Event Mesh Callback Access",
"grant-as-authority-to-apps": ["$XSSERVICENAME(em_gxp_poc)"]
}
],
"attributes": [],
"role-templates": [
{
"name": "emUser",
"description": "generated",
"scope-references": ["$XSAPPNAME.emUser"],
"attribute-references": []
}
]
}
Unfortunately the parameters will not be recognized as an parameter in the service descriptor:
I noticed the same behaviour for the "version"-parameter of the instance descriptor. I think i read in the documentation, that this is because of the dev plan.
Adding the scope to the xsuaa didn't change anything 😞 The options call still results in a 401 error.
Best regards,
Daniel
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.