cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sending notification to SAP build workzone from CAP app

David21
Explorer

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
SAP Mentor
SAP Mentor

Please use the CAP Plugin https://github.com/cap-js/notifications instead. But be aware that you have to use CAP 7 right now until Current peerDependency doesn't match cds 8 #57 is fixed.

David21
Explorer
0 Kudos
Appreciate the answer, just had a question about the setup. If i want to use it in production environment do i need to integrate the entire project in my app i.e. the util folder, notifytoRest.js file e.t.c or do i just add the plugin using npm Install and that will do it for me ?
gregorw
SAP Mentor
SAP Mentor
0 Kudos
I suggest you read through the CAP Plugin documentation: https://cap.cloud.sap/docs/node.js/cds-plugins
David21
Explorer
0 Kudos
It gives the following error: [notifications] - Sending notification of key: Default and version: 1 [persistent-outbox] - Emit failed { event: 'Default', cause: Error: NotificationType with key Default and version 1 does not exist at NotifyToRest.postNotification (/home/user/projects/Student/node_modules/@cap-js/notifications/srv/notifyToRest.js:35:21) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async NotifyToRest.handle (/home/user/projects/Student/node_modules/@sap/cds/lib/srv/srv-dispatch.js:65:21) at async ODataRequest.<anonymous> (/home/user/projects/Student/node_modules/@sap/cds/libx/outbox/index.js:286:18) at async ODataRequest.emit (/home/user/projects/Student/node_modules/@sap/cds/lib/req/context.js:58:9) at async ApplicationService.commit (/home/user/projects/Student/node_modules/@sap/cds/lib/srv/srv-tx.js:132:7) at async /home/user/projects/Student/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js:61:9 { unrecoverable: true } }
gregorw
SAP Mentor
SAP Mentor
0 Kudos
I would suggest you file an incident via the plugins GitHub repository.

Answers (2)

Answers (2)

David21
Explorer
0 Kudos

@MioYasutake 

yes the destination is working fine, the host URl did look odd to me as well but it is the one generated when i click on credentials . I was able to send the alert notifications from CAP app to build workzone using the following documentation:

https://help.sap.com/docs/cloud-portal-service/sap-cloud-portal-service-on-cloud-foundry/developing-...

The plugin works for me in the development env and the alert shows in the console, But it doesn't work in the production environment.

David21
Explorer
0 Kudos

I have read the documentation and added the plugin. I have used it in a test app that i have deployed on the build workzone but it is not creating notifications. The package.json looks like this:

package.png

package2.png

And this is the service handler:

js.png

 Destination:

destlatest.png

@gregorw 

 

 

MioYasutake
SAP Champion
SAP Champion
0 Kudos

@David21

I was able to use the notification plugin successfully. The image in the link below is my destination setting.

https://qiita.com/tami/items/7c786f9d79a5fd157b24#2-destination%E3%81%AE%E7%99%BB%E9%8C%B2

I noticed a difference in URL. Please check if the host part matches the credentials generated in the Build Work Zone.