Uploading attachment from backend API

Can we assume that an attachment will be immediately in the uploaded/present state in the OnlineDB after uploading it via a backend API request in CloudCode?

Would this also apply to using Attachment.create() in CloudCode?

I think it depends on where you want to make that assumption. For example, I have a CC task that is triggered from the App with base64 image data. The CC task then creates an Attachment and responds back to the app with the secure URL to the newly created Attachment so that I can reference that URL in the App. However, in my CC task I first have to await object.reload() before being able to reliably access the object.attachment_field.url().

Like this.

export async function run(params) {
    // Your code here
    if (params && params.base64) {
        let newAttachment = await Attachment.create({ filename: 'upload.png', base64: params.base64 })
        let image = DB.image.create();
        image.photo = newAttachment
        await image.save();
        await image.reload();

        let url = image.photo.url();
        console.log('URL: ', url);
        return url;
    } else {
        return false;
    }
}