Per the google API documentation regarding DELETE:
If successful, this method returns an empty response body.
This causes gmail_query to fail, as it is expecting a non-empty response
Example
use_secret_file("email-automation.json")
msgs <- messages(label_ids = "Label_14")
local_path <- "."
for (ids in msgs[[1]]$messages) {
id <- ids$id
msg <- message(id)
save_attachments(msg, path = local_path)
delete_message(id)
}
Error
Error in class(result) <- class : attempt to set an attribute on NULL