I'm trying to use Multiversion but I ran into a problem as soon as I enable it. I'm not sure if the fix is needed on Multiversion or Flysystem, but I thought I'd get your input.
Flysystem is working great and exactly as it should. However as soon as I enable Multiversion is when I get the problem. I try to add a node which has an image field. I browse for the image and after the progress indicator is complete the preview image never appears. I then try to save the node but I am unable to because the image is required and it wasn't loaded.
I'm fairly new to Drupal, but it seems that Multiversion is running a hook using a wrong service. Here is the error code that I get from the log:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "stream_wrapper.s3-files". Did you mean one of these: "stream_wrapper.public", "flysystem_stream_wrapper.s3-files"? in Drupal\Component\DependencyInjection\Container->get() (line 157 of /var/www/html/eldoradoshreveport.com/drupal/core/lib/Drupal/Component/DependencyInjection/Container.php)
As I said, Flysystem was working fine before so I'm pretty sure Multiversion is causing this error. I just thought I'd get you opinion on where I should start looking for the cause of this error.
Thanx a lot for you help.
Comment | File | Size | Author |
---|---|---|---|
#16 | relaxed.jpg | 93.25 KB | chavab_1 |
#8 | multiversion-stream-wrapper-handling-full-patch-2777899-8.patch | 5.07 KB | twistor |
#4 | multiversion-stream-wrapper-handling-full-patch-2777899-4.patch | 4.65 KB | twistor |
#3 | multiversion-stream-wrapper-handling-2777899-3.patch | 830 bytes | twistor |
Comments
Comment #2
twistor CreditAttribution: twistor as a volunteer commentedYep, moving over to Multiversion. Will post patch shortly.
Comment #3
twistor CreditAttribution: twistor as a volunteer commentedSooo, this should fix the issue reported above, but the code is still incorrect.
multiversion_prepare_file_destination() should not take a
StreamWrapperInterface
as an argument. Stream wrappers shouldn't be instantiated by themselves except for the methods directly defined onStreamWrapperInterface
.Comment #4
twistor CreditAttribution: twistor as a volunteer commentedHere's a quick version of a correct approach.
There are still some questions left undecided.
Comment #8
twistor CreditAttribution: twistor as a volunteer commentedThere's a race condition in
multiversion_prepare_file_destination()
.I'm actually not sure why it exists at all. Here's a patch that uses
file_prepare_directory()
.Comment #9
twistor CreditAttribution: twistor as a volunteer commentedAnother curiosity, why does
Drupal\multiversion\StreamWrapper\MigrateStream
even exist? I haven't gone through all the code, but it looks like you're trying to define a sub-directory inside public files. This should not be a stream wrapper.MigrateStream::basePath()
doesn't take into account a lot of thingsDrupal\Core\StreamWrapper\PublicStream
does. It seems like themigrate://
stream wrapper should just bepublic://migrate
.I could be missing something here.
Comment #10
chavab_1 CreditAttribution: chavab_1 commentedThanx a lot @twistor!! That patch worked.
Comment #11
dixon_@twistor Thanks for the work on this. These fixes makes sense I think. The reason for creating a new stream wrapper was just to make it easier to keep the same paths for the files, and just change the scheme. That way, we don't have to mess around with appending and removing
migrate/
from the path all the time. But I'm happy to reconsider this, and just use the public stream wrapper.However, I think the patch as it stands now looks like a good first step in the right direction. Maybe we can consider removing the migrate stream wrapper in a follow-up.
Comment #13
jeqqThanks @twistor!
Created #2778321: Remove MigrateStream and use a default stream to store the files during migration
Comment #14
twistor CreditAttribution: twistor as a volunteer commentedThat was quick!
Any thoughts on the todo I added in #8?
Comment #15
jeqq@twistor I've created #2778851: Review if the destionation should be set when the file moving fails for this.
Comment #16
chavab_1 CreditAttribution: chavab_1 commentedHey guys, I get the same error but now only after I run a deploy. I know the problem is no longer on Multiversion so I'm wondering if a similar fix is required on Relaxed Web Services as that's the type that I get from the Log report. I wasn't sure if I should open this issue on Relaxed's section since you guys are on top of it.
I really appreciate if you help me out.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "stream_wrapper.s3-files". Did you mean one of these: "stream_wrapper.public", "flysystem_stream_wrapper.s3-files"? in Drupal\Component\DependencyInjection\Container->get() (line 157 of /var/www/html/eldoradoshreveport.com/drupal/core/lib/Drupal/Component/DependencyInjection/Container.php)
Comment #17
jeqq@chavab_1: https://www.drupal.org/node/2779297#comment-11477811