Doug DeBold
05/19/2026, 3:43 PMCommunication, if we update that resource again, it is VERY easy to replace the link to the Binary with a hard-coded signed URL pointing. This then quickly expires and makes the image unavailable for viewing. As far as I can tell, this applies to every single resource that may have a binary attached to it.
How to replicate:
1. Create a resource with an attached Binary
2. Do an full update of the resource, e.g. medplum.updateResource(...communication, sent: new Date())
3. Notice that payload.contentAttachement will have changed even through it wasn't updated
This foot-gun has bit us at least 3 times now. Maybe we are doing something wrong, but aside from banning the use of updateResource I really don't see how to prevent this. Any ideas?Darren
05/22/2026, 10:06 AMCommunication.payload value to change.
In this case, I'd suggest using patchResource() instead, where instead of:
tsx
medplum.updateResource(...communication, sent: new Date())
You’d do something like:
tsx
await medplum.patchResource('Communication', communication.id, [
{ op: 'replace', path: '/sent', value: new Date().toISOString() }
]);
The patchResource() command will ensure that only the specified fields on the resource are updated. If the Communication.payload needs to remain untouched, then leave it out of the array of operations.
Please let me know if this solves your issue, or if you have anything you’d like to follow up on!
Ref: https://www.medplum.com/docs/sdk/core.medplumclient.patchresourceDoug DeBold
05/22/2026, 6:16 PMpatchResource(). But sometimes when dealing with nested data patch is really hard to use/impossible and you have to fall back to updateResource().
The fact that using updateResource() if there's an attachment will effectively kill the attachment feels like a big foot-gun that needs to be called out or fixed.
Is there appetite for some sort of fix here?