After upgrading a site to Drupal 9 and updating flysystem_s3 to 2.0.0-rc1 (which is supposed to have d9 support) I still get an error for a method that has changed since d8:
The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\flysystem_s3\File\FlysystemS3FileSystem::uriScheme() in Drupal\flysystem_s3\S3CorsManagedFileHelper::preProcessCors() (line 34 of modules/contrib/flysystem_s3/src/S3CorsManagedFileHelper.php).
In Drupal 9 \Drupal::service('file_system')->uriScheme() has been replaced with \Drupal::service('stream_wrapper_manager')->getScheme()
Heads up: this issue is tagged version 8.x-1.x-dev but it's patching 2.0.0 which wasn't available when creating the issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | FlysystemS3.jpg | 299.46 KB | nicolas bouteille |
| #21 | replace-urischeme-method-3159928-20.patch | 2.6 KB | leon kessler |
| #19 | replace-urischeme-method-3159928-19.patch | 2.96 KB | leon kessler |
| #6 | replace-urischeme-method-3159928-4.patch | 2.21 KB | timkruijsen |
| #3 | replace-urischeme-method-3159928-3.patch | 2.21 KB | slasher13 |
Issue fork flysystem_s3-3159928
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jascote commentedHere's a patch to fix this for anyone upgrading to Drupal 9.
Comment #3
slasher13more replacements
Comment #4
kreynen commentedThis patch worked for me.
Comment #5
achapPatch works for me! Thanks :) Can any maintainers allow us to run the tests against the 2.x branch?
Comment #6
timkruijsen commentedI've changed the patch a bit so it works on the 2.x branch
Comment #8
lisa.rae commentedIssue version notes this patch is for 8.x-1.x, but the last note indicates that the patch for #6 is for the 8.x-2.x branch. Please clarify which branch we are patching in this issue.
Update: This patch applies to both 1.0 and 2.0. Can confirm that this rectifies the issue. RTBC.
Comment #9
lisa.rae commentedComment #10
mglaman+1 #6 made using this on Drupal 9 possible.
Comment #13
leon kessler commentedAdded MR with patch from #6
Comment #14
mykola dolynskyi@Leon Kessler thanks, waiting for this release
Comment #15
leon kessler commentedThis project is currently not being actively maintained, it's been quite a while since any patches were merged in.
I've opened #3258564: Offering to co-maintain flysystem_s3 to help get issues like this one, into a release.
Comment #16
leon kessler commentedI now have commit access to this module, so will be working on merging this change in and creating a new release.
As this will break compatibility with Drupal 8.x, I've updated dependencies to be for 9.x.
Setting this back to needs work as it's not running through the test runner correctly.
Comment #17
damienmckennaFWIW patch #6 resolved the problem for me.
Comment #18
leon kessler commentedTest runner issues are not actually related to this patch. So will set back to RTBC and focus on fixing tests in #3254472: Update tests to work with Drupal 9
Comment #19
leon kessler commentedTests have now been fixed in 2.0.x. Re-posting patch from the MR (not sure why but the test runner doesn't seem to work correctly with gitlab MRs).
Comment #20
leon kessler commentedComment #21
leon kessler commentedI think the test runner issue is related to updating the composer.json file in the patch. I've posted on the drupal-infra slack channel (where I saw that someone else is having the same issue).
Here's the patch without the composer.json file change. If this passes, I suspect we can probably commit the previous patch (with composer.json) changes as the issue is that drupal infra doesn't like patches updating composer.json files.
Comment #23
leon kessler commentedMerged in the gitlab MR that included the composer.json change. This appears to have run OK through the test runner https://www.drupal.org/pift-ci-job/2303413
Will tag a new release 2.0.0-rc2
Comment #24
nicolas bouteille commentedHello,
I am currently trying to upgrade my website to D9.
I have flysystem_s3 2.0.0-rc2 installed, yet when running drush cr I got the following error:
PHP Fatal error: Uncaught Error: Call to undefined method Drupal\Core\File\FileSystem::uriScheme() in /[…]web/modules/contrib/flysystem_s3/src/File/FlysystemS3FileSystem.php:63
I checked the source code, info.yml says:
version: '2.0.0-rc2'
project: 'flysystem_s3'
datestamp: 1643119088
class FlysystemS3FileSystem line 62:
public function chmod($uri, $mode = NULL) {
$scheme = parent::uriScheme($uri);
So it looks like the patch did not make it into the rc2 realease ?
Comment #25
nicolas bouteille commentedBy the way, unfortunately patch does not seem to apply on D9.3.3 :(
EDIT : I guess the problem is not D9.3.3 but that I should probably downgrade to rc1 so that I can apply the patch...
EDIT 2 : nope, still no luck after downgrading to RC1... patch won't apply :(
Comment #26
leon kessler commentedSorry yes! I merged the MR but created the tag locally (without pulling the change), so yes it wasn't included. (Grrr this gitlab/patch workflow is not ideal).
Creating a new release 2.0.0-rc3 now to fix that.
Comment #27
nicolas bouteille commentedGreat it works for me now :) thank you so much I am very lucky you actually fixed it right when I made the upgrade :)