wixData Insert results in RangeError

When calling the add data function:

function addData(query, response, id) {
  var data = {
    "result": response,
    "query": query,
    "userId": id
  };

  wixData.insert("queries", data).then((item) => {
    console.log(`added ${item} to database`); //see item below
  }).catch((err) => {
    console.error(`add data error ${err}`);
  });

}

It results in the error:

["add data error RangeError: Maximum call stack size exceeded"]


This is my queries collection, and it’s currently empty. I checked and the function is receiving three strings as input.

Checked your code…

import wixData from 'wix-data';

$w.onReady(function() {console.log("dataset ready");  
  addData("myTitle", "myFirstName", "myLastName");

  function addData(response, query, id) {
    let data = {
      "title": response,
      "firstName": query,
      "lastName": id
    };

    wixData.insert("DATABASE", data).then((item) => {
      console.log(`added ${item} to database`); 
    }).catch((err) => {console.error(`add data error ${err}`);});
  }
});

And this was my result inside of my test-database with the ID → “DATABASE”…

No ERRORs. What exactly was the problem ?