When trying to delete a node that already had the file deleted from the S3 bucket produces the following error.

LogicException: A URI must be set before calling getOptions(). in Drupal\amazons3\StreamWrapper->getOptions() (line 358 of <drupal location>/sites/all/modules/amazons3/src/StreamWrapper.php).

The AWS team purged the S3 bucket of all of the files and then I was tasked with removing the nodes from Drupal. The following error stops the node from being deleted. I am looking into fixing this in the short term so I can delete the nodes.

CommentFileSizeAuthor
#3 amazons3_delete_unlink-2825825-03.patch471 bytestinker
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mayday created an issue. See original summary.

kyledesu’s picture

I am having a similar issue. Everything uploads fine but unable to edit or delete.

When going to edit I can upload a new image to S3 but it will not update the node.

Also I'm Using Cloudfront and S3 with the ACL set to private.

tinker’s picture

Status: Active » Needs review
FileSize
471 bytes

In my case this was happening for all S3 files attached to nodes when the node is deleted. The drupal extended stream wrapper does not set the URI before trying to unlink() the file. This causes getOptions() to throw the LogicException.

Attached patch adds override for unlink() to set the URI before the calling parent::unlink().

tinker’s picture

Status: Needs review » Fixed

Sorry just noticed that this is already in 7.x-2.1-beta1. Please disregard the patch and upgrade module instead. Marking this as fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.