Hey, perhaps only to confirm as I already saw this old and closed issue…
It is not implemented to save an object in the cloud code with a customId? I am following the example in the documentation to keep track of saved files in the storage and I was thinking about using the saved file name as a custom objectId as it is already a unique name and I would need to index the name field anyway.
My code to save the object in afterFileSave
trigger is:
Parse.Cloud.afterSaveFile(async (request) => {
const { file, fileSize, user } = request;
const name = file.name();
request.log.info(`file saved: ${name}`);
const fileObject = new Parse.Object('FileObj');
fileObject.set('objectId', name);
fileObject.set('file', file);
fileObject.set('size', fileSize);
fileObject.set('cb', user.id);
const token = { sessionToken: user.getSessionToken() };
await fileObject.save(null, token);
});
from console I can see the urls and can also open the saved files, they are being saved successfully. But in the afterFileSave
trigger I get an error ParseSwift.ParseError.Code.fileSaveFailure, message: "Object not found."
I assume this is because it is not possible to set customId as it is not implemented in JS SDK? Or are there any forbidden character like “.”, “_”,… for the objectId?
Thank you for confirmation!