Getting record undefined error when using node js and cloudkit js to save image file to a record.
The image is stored in a field called 'data' with field type 'Bytes'.
fs.readdirSync(readImageFolder).forEach(file => {
var imageData = fs.readFileSync(readImageFolder + '//' + file);
filename = file.slice(0, -4);
newRecord = {
recordName: filename,
recordType: 'Images',
fields: { data: {value: imageData} }
};
})
After calling database.saveRecords(newRecord), the response came back with record undefined and the record was not saved
CloudKitJS RecordsBatchBuilder#commit
--> Saved Record:
undefined
Maybe I have to convert the imageData to a different data type before calling saveRecords?
Thanks!