The code works fine in PREVIEW, but it runs in to an error in PUBLISH!!

My code works fine during preview. however code isn’t work during publish.
At first, At first, I thought the error was caused by ‘startUpload’. So, I changed ‘startUpload’ to ‘fileUpload’. But the error is on going.
I have been desperately wrestling with this problem for the past 2 weeks!!!
I have not been able to figure it out.

import wixData from 'wix-data';
import wixLocation from 'wix-location';
import {session}from 'wix-storage';

export function savebutton_click(event) {
 let toInsert = {
 "title" : $w('#title').value,
 "photo" : $w("#image1").src,
 "startdate" : $w('#datePicker1').value,
 "findate" : $w('#datePicker2').value,
 "story" : $w('#textBox3').value,
 "effect" : $w('#textBox4').value,
 "membercount" : Number($w('#input2').value),
 "runtime" : Number($w('#input3').value),
 "count" : Number($w('#input4').value),
 "cost" : Number($w('#input5').value),
 "targetnumber": Number($w('#input6').value),
 "targetprice" : Number($w('#input7').value),
 "special" : $w("#richTextBox1").value,
 "place" : $w('#input8').value,
 "address" : $w('#input9').value,
 "seatcount" : Number($w('#input10').value),
 "placesize" : Number($w('#input11').value),
 "stagespecial": $w('#richTextBox2').value,


wixData.insert("Team", toInsert)
 .then( (results) => {
    console.log("save finish");
 let item = results; //see item below'/team'); 
 } )
 .catch( (err) => {
 let errorMsg = err;
    console.log("save fail");
 } );



export function uploadButton_change(event) {
 .then( (uploadedFiles) => {
    uploadedFiles.forEach(uploadedFile => {
      $w("#image1").src = uploadedFile.fileUrl;
 let url = uploadedFile.fileUrl;
      console.log('File url:', uploadedFile.fileUrl);
 .catch( (uploadError) => {
 let errCode = uploadError.errorCode; // 7751
 let errDesc = uploadError.errorDescription; // "Error description"
} );

Which error do you get in the PUBLISHED-VERSION?

Did you sync your DBs (Preview & LIVE)?
What about DB-Permissions? Permission-Setup ok ?

Hi, thanks to reply.

The error → In the PREVIEW-VERSION, when I press the ‘SAVE Button’, all the data got inserted in to the DB.
But, in the PUBLISHED-VERSION, when I press the ‘SAVE Button’, all data didn’t insert in to the DB.

I synced my DBs(preview, live).

DB permission is ‘Member-Generated Content’. So it is not problem.