wixData.save doesn't work at live page.

I use this code at register page.
I works at preview page.
But when I use it at live page after save and post it, it doesn’t work.
Furthermore, it doesn’t show error message.
I don’t know what should I do.
Plz someone tell me what is the problem and how to fix it.

import wixData from ‘wix-data’ ;
import wixUsers from ‘wix-users’ ;

let marketingAgreement;
let emailInfo;

function handler(){
emailInfo = $w( ‘#createEmailInfo’ ).value;
marketingAgreement = $w( ‘#marketingAgreement’ ).checked;
console.log( “emailInfo” , emailInfo);
console.log( “marketingAgreement” , marketingAgreement);

let toSave = {
“email” : emailInfo,
“privacy” : true ,
“termsOfUse” : true ,
“promotionalAgreements” : marketingAgreement
};
wixData.save( “agreements” , toSave)
.then( (results) => {
let item = results; //see item below
console.log( “item” , item);
} )
. catch ( (err) => {
let errorMsg = err;
console.log( “err” , errorMsg);
} );
}

$w.onReady( function () {
// TODO: write your page related code here…

$w( '#registrationForm1' ).onWixFormSubmitted(handler); 

});

Check your database permissions.