Hi! I'm having a new error in a backend function I have since many months ago. I have stopped receiving notifications, and right now I'm checking the code and found that when I call this "wixCrm.notifications.notify" it came with a bunch of errors displayed on the console log. My function is:
import wixCrm from 'wix-crm-backend'; export function notifyNewSignature(pTitle,pDesc,pActionTitle,pURL,pRole) { wixCrm.notifications.notify( pDesc, ["Browser","Dashboard","Mobile"], { "title": pTitle, "actionTitle": pActionTitle, "actionTarget": {"url": pURL}, "recipients": { "role": pRole} //"Owner" "All_Contributors" } ); //console.log("Backend: NotificarMessage enviado") }
The errors I'm getting are these (displayed on Console Log):
Unhandled rejection TypeError: logger.debug is not a function at /dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/src/notifications/api.ts:26:10 at Generator.next (<anonymous>) at /dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/dist/src/notifications/api.js:8:71 at Promise._execute (/elementory/node_modules/bluebird/js/release/debuggability.js:384:9) at Promise._resolveFromExecutor (/elementory/node_modules/bluebird/js/release/promise.js:518:18) at new Promise (/elementory/node_modules/bluebird/js/release/promise.js:103:10) at __awaiter (/dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/dist/src/notifications/api.js:4:12) at Object.exports.notify (/dynamic-modules/edm_root/3d049220-22ca-11eb-b9ec-a16ccc5e7368/node_modules/@wix/wix-crm-backend/src/notifications/api.ts:25:5) at notifyNewSignature (/user-code/backend/notifications.jsw:4:24) at webMethodWrapper (/elementory/src/js-server-side/web-module-extension.js:39:33) at /elementory/node_modules/wix-error-boundaries/dist/index.js:11:23 at FunctionExecutor._run (/elementory/node_modules/@wix/cloud-runtime-core/lib/processors/AbstractFunctionExecutor.js:18:26) at FunctionExecutor._execute (/elementory/node_modules/@wix/cloud-runtime-core/lib/processors/FunctionExecutor.js:21:45) at /elementory/node_modules/@wix/cloud-runtime-core/lib/processors/AbstractFunctionExecutor.js:11:12 at /elementory/node_modules/@wix/cloud-monitoring-js/index.js:298:22 at FunctionExecutor.execute (/elementory/node_modules/@wix/cloud-runtime-core/lib/processors/AbstractFunctionExecutor.js:10:85) at /elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeProcessor.js:54:34 at /elementory/node_modules/@wix/cloud-monitoring-js/index.js:298:22 at /elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeProcessor.js:53:64 at RuntimeEnvironment.withEnv (/elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeEnvironment.js:23:28) at RuntimeProcessor.process (/elementory/node_modules/@wix/cloud-runtime-core/lib/RuntimeProcessor.js:35:31) at handler (/elementory/src/handlers/web-methods/index.js:74:8) at Layer.handle [as handle_request] (/elementory/node_modules/express/lib/router/layer.js:95:5) at next (/elementory/node_modules/express/lib/router/route.js:137:13) at webMethodRouteValidator (/elementory/src/handlers/web-methods/index.js:39:14) at Layer.handle [as handle_request] (/elementory/node_modules/express/lib/router/layer.js:95:5) at next (/elementory/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/elementory/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/elementory/node_modules/express/lib/router/layer.js:95:5) at /elementory/node_modules/express/lib/router/index.js:281:22 at param (/elementory/node_modules/express/lib/router/index.js:354:14) at param (/elementory/node_modules/express/lib/router/index.js:365:14) at param (/elementory/node_modules/express/lib/router/index.js:365:14) at param (/elementory/node_modules/express/lib/router/index.js:365:14)
Thanks!
link to the editor:
I have many notifications on my site. it was functioning great until the 2nd of November. all of them stopped working at the same time without me changing anything.
I tried to update the code according to the updated API, but the error remains the same: I don't receive notifications at all and I see this error:
Unhandled rejection TypeError: logger.debug is not a function
That's my code to one of my notifications. it's on my MasterPage.Js, it should give me a notification each time a person clicks the green box on the button left side of the page.
my domain: www.sbe-studio.com
Front end:
import { notifyWhatsapp } from 'backend/notifications'; export function box38_click(event) { notifyWhatsapp(); }
Back end:
import { notifications } from 'wix-crm-backend'; export function notifyWhatsapp() { notifications.notify( "לחיצה על פניית וואטסאפ מהאתר", ["Dashboard", "Mobile", "Browser"], { "title": "וואטסאפ מהאתר", "recipients": { "role": "Owner" } } ); }
Thanks! :)
i checked now, and i also get the same error saying:
logger.debug is not a function
maybe @Yisrael (Wix) can help?
hi Roger,
I also have issues with previously working code. all my site notifications stopped working about a week ago without notice.
I see that Wix updated the API. you should import:
import {notifications} from 'wix-crm-backend';
instead of: import wixCrm from'wix-crm-backend';
and you should delete 'wixCrm.' from your code at: wixCrm.notifications.notify(...
it should look like this:
export function notifyOwnerOnDashboard() { 4 notifications.notify( 5 "Notification body", 6 ["Dashboard"], 7 { 8 "title": "Notification Title", 9 "actionTitle": "Click this!", 10 "actionTarget": {"url": "http://mysite.com/somepage"}, 11 "recipients": {"role": "Owner"} 12 } 13 ); 14}
and that's the backend side if it wasn't clear enough.
for the full API go to:
https://www.wix.com/corvid/reference/wix-crm-backend/notifications-obj/introduction
but remember: it's not working now, I don't know why. I hope that someone from Wix could help with this matter...
maybe @Aleksander Denga? I see that you helped with a similar issue on another post,
OK. New update, I'm also getting an error when I also use this function in the backend (see below), but it just happens (as I know so far) when the UserID is one of the following WIX Role: "Owner" or "administrator". Same as before, I had this code working without error a long time ago, but right now it isn't working anymore :(
wixUsersBackend.emailUser(vEmailAccionable, vUserID1, { "variables": { "eSubject": pSubject, "eDesc": pDesc } } ) .then( () => { } ) .catch( (err) => { // there was an error sending the email let myErr = err console.log(vUserID1+"||"+"fEmailAdmin Error: " + myErr) return (myErr) } );
The error I'm getting is:
Error: server responded with - {"message":"","details":{}} (500)