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

notification plugin not working with cap project with cds =>8.0.0 #71

Closed
devadmin110-qg opened this issue Sep 21, 2024 · 3 comments · Fixed by #76
Closed

notification plugin not working with cap project with cds =>8.0.0 #71

devadmin110-qg opened this issue Sep 21, 2024 · 3 comments · Fixed by #76

Comments

@devadmin110-qg
Copy link

notification plugin not working with cap project with cds =>8.0.0

@Regloom
Copy link
Contributor

Regloom commented Sep 30, 2024

In particular build script should be updated:
[2024-09-30 11:47:45] INFO executing the "npx cds build --production" command... The cds build plugin 'notifications' is not compatible with this @sap/cds-dk version. Update the npm package '@cap-js/notifications/lib/build' to the latest version. [2024-09-30 11:47:46] ERROR the "before-all"" build failed: could not execute the "npx cds build --production" command: exit status 1

Here is a sample commit.

@martindonadiosap
Copy link

I am getting the same error

.[2024-09-30 16:12:04] INFO executing the "npx cds build --production" command...
.....The cds build plugin 'notifications' is not compatible with this @sap/cds-dk version. Update the npm package '@cap-js/notifications/lib/build' to the latest version.
[2024-09-30 16:12:10] ERROR the "before-all"" build failed: could not execute the "npx cds build --production" command: exit status 1
make: *** [Makefile_20240930161130.mta:28: pre_build] Error 1
[2024-09-30 16:12:10] ERROR could not build the MTA project: could not execute the "make -f Makefile_20240930161130.mta p=cf mtar= strict=true mode=" command: exit status 2
Error: could not build the MTA project: could not execute the "make -f Makefile_20240930161130.mta p=cf mtar= strict=true mode=" command: exit status 2

cds -v output:

@cap-js/asyncapi: 1.0.2
@cap-js/cds-types: 0.6.5
@cap-js/notifications: 0.2.1
@cap-js/openapi: 1.0.5
@cap-js/sqlite: 1.7.3
@sap/cds: 8.2.3
@sap/cds-compiler: 5.2.0
@sap/cds-dk: 8.2.3
@sap/cds-dk (global): 8.0.2
@sap/cds-fiori: 1.2.7
@sap/cds-foss: 5.0.1
@sap/cds-mtxs: 2.1.0
@sap/eslint-plugin-cds: 3.0.5
Node.js: v18.18.0
home: C:\Node\test_import_alert\node_modules@sap\cds
test_import_alert: 1.0.0

@Regloom
Copy link
Contributor

Regloom commented Oct 21, 2024

Build comman is fixed now however cds w --profile hybrid doesn't work and provides the following output:

❗️ ERROR on server start: ❗️

 TypeError: Cannot read properties of undefined (reading 'Plugin')
    at Object.<anonymous> (/home/user/projects/freshairmanager/node_modules/@cap-js/notifications/lib/build.js:5:67)

During plugin initialization cds.build is undefined.

easy fix: in file @cap-js/notifications/cds-plugin.js move const NotificationsBuildPlugin = require("./lib/build") to if (cds.cli.command === "build") block:

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

if (cds.cli.command === "build") {
  // register build plugin
  cds.build?.register?.('notifications', require("./lib/build"));
}

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

Successfully merging a pull request may close this issue.

3 participants