Uncaught (in promise) Error: Unable to handle the request, contact site administrator

Hi Everyone !!!
I am having a site here, which when I try to insert an item to the database, returns this error in the console…

The editor url is → https://editor.wix.com/html/editor/web/renderer/edit/1297fd2c-7567-46a5-a620-6e7bf945aa83?metaSiteId=00249b10-ba15-4313-85c9-666cf51a8355&editorSessionId=853fa306-3534-4ca0-9374-fbc69e4dc8f6&referralInfo=dashboard

Any idea ??
@yisrael-wix

Permissions?

Is this happening in Preview/Live/Both?

Hi Yisrael !!!
The Database collection permission is set to 'Anyone ’


Actually, after you posted, I just previewed the site, I got where the error was !!
It was in my data.js file. But, in the live site, it just logged this error ( Uncaught (in promise) Error: Unable to handle the request, contact site administrator) not saying anything about the error in the data.js.

All though , I couldn’t detect the where the error is !!!
I am using the ’ bad-words ’ npm…

//data.js
export function List_beforeInsert(item, context) {
 var Filter = require('bad-words'),
        filter = new Filter();
    filter.clean(item.toDo.name);
    filter.clean(item.inProgress.name);
    filter.clean(item.done.name);
 return item;
}

The error I am receiving →

Hey @ajithkrr , I took a look at your site and it looks like you gave on bad-words. Were you still having issues with it?

Unfortunately, Wix can’t provide support on NPM libraries since we have no idea if they even work correctly. The error that you were receiving certainly sounds as if it’s an issue with the bad-words library. You might want to check with the authors of that library for assistance.

@ajithkrr I would suggest, as “best practice”, putting the require statement at the top of the file and not in the List_beforeInsert() function.

var Filter = require('bad-words');

I’m not sure if that was the cause of the error (most likely not the cause), but it might affect performance.