Lifecycle update a article

System Information
  • Strapi Version:
    @strapi/strapi”: “4.1.9”

  • Operating System:
    BigSur

  • Database:
    mysql

  • Node Version:
    16

  • NPM Version:

  • Yarn Version:
    1.22

I’m trying to give a update in the database but i am getting

  • FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

this is a lifecycle file:

module.exports = {
async beforeUpdate(event) {
console.log(“aquiii”)
const entry = await strapi.query(‘api::article.article’).update({id: 4},{title:“cccccc”});
console.log(entry)
},
};


Thats because you are using it wrong, you just created loop. This updates entry in collection type and it triggers lifecycle hooks: strapi.query(‘api::article.article’).update({id: 4},{title:“cccccc”});

beforeUpdate(event) {
  console.log(event);
  event.params.title='ccccc';
}

Something like this, check console.log output