Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin not working after following setup (cant find notification types) #78

Open
js1972 opened this issue Oct 29, 2024 · 1 comment
Open

Comments

@js1972
Copy link

js1972 commented Oct 29, 2024

I'm trying to get this plugin to work after following the simple setup steps:

image

My destination is called SAP_Notifications to match.
image

However I get this error on cloud foundry:

ERROR | persistent-outbox | Emit failed { event: 'Default', cause: Error: Could not find service binding of type 'destination'

So I tried adding to the package.json (cds.requires section):

"notifications": {
      "destination": "SAP_Notifications"
}

Along with a binding to the destination service and now it finds the destination and I get this error:

Emit failed { event: 'Default', cause: Error: NotificationType with key Default and version 1 does not exist at NotifyToRest.postNotification (/home/vcap/app/node_modules/@cap-js/notifications/srv/notifyToRest.js:35:21)

So what magic is required to get a notification into work zone? The documentation (Screenshot above) clearly states that none of these config settings are required.

ps. In addition I have tested with a custom notification type and get the same error as shown here:

ERROR | persistent-outbox | Emit failed { event: 'ConsumptionBlockerCreated', cause: Error: NotificationType with key engagementplanner/ConsumptionBlockerCreated and version 1 does not exist at NotifyToRest.postNotification (/home/vcap/app/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/vcap/app/node_modules/@sap/cds/lib/srv/srv-dispatch.js:65:21) at async ODataRequest.<anonymous> (/home/vcap/app/node_modules/@sap/cds/libx/outbox/index.js:286:18) at async ODataRequest.emit (/home/vcap/app/node_modules/@sap/cds/lib/req/context.js:58:9) at async CustomersService.commit (/home/vcap/app/node_modules/@sap/cds/lib/srv/srv-tx.js:132:7) at async /home/vcap/app/node_modules/@sap/cds/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js:61:9 { unrecoverable: true } }
@js1972 js1972 changed the title Plugin not working after following setup Plugin not working after following setup (cant find notification types) Oct 29, 2024
@js1972
Copy link
Author

js1972 commented Oct 29, 2024

I managed to get the notification to work as alluded to in #44 even though it didn't show the full details. Added a server.js to the project with this:

const cds = require("@sap/cds");

cds.on("served", async () => {
    if (process.env.NODE_ENV === "production") {
        const {deployNotificationTypes} = require("@cap-js/notifications/lib/content-deployment");
    }
});

// Delegate bootstrapping to the default CDS server
module.exports = cds.server;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant