Assistants Upload file 400 Invalid file format

Uploading a .json file with Lambda results in an error.

static async CreateLocalFile({ file, user_id, date, type }) {
      try {
         const filePath = path.join("/tmp", `${user_id}-${type}-${date}.json`);
         const jsonData = JSON.stringify(file);
         fs.writeFileSync(filePath, jsonData, { encoding: "utf8" });
         return filePath;
      } catch (error) {
         console.error("Error creating local file:", error.message);
         throw error;
      }
   }

   static async UploadFiles(params) {
      try {
         const filePath = await this.CreateLocalFile(params);
         const files = await openai.files.create({
            file: fs.createReadStream(filePath),
            purpose: "assistants",
         });
         return files;
      } catch (error) {
         console.error("Error uploading file:", error.message);
         throw error;
      }
   }