Upload json into aws3 bucket

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hello guys!
I’m trying to upload a file when lifecycle hooks is called but i’m having a error.

This is the function that i’m using.

afterDelete(data) {
      const { uri, title, originUrl, banner, description, modal} = data;
      const payload = {
        uri, title, originUrl, banner, description, modal
      console.log('deletado', payload)

      let fs = require('fs');
      let partnership = fs.writeFile("partnership.json", payload);

      const request = new XMLHttpRequest();

      request.open('POST', '/api/upload');

      //chamar plugin AWS fazendo upload