Problem/Motivation
HTTP 500 errors and PHP Fatal error: Class 'Aws\S3\StreamWrapper' not found in /var/www/html/sites/all/modules/contrib/s3fs/S3fsStreamWrapper.inc on line 28
Attempting to install S3FS v3 with AWS SDK v3, but am unable to get anywhere. Attempting to uninstall the module results in the same.
Steps to reproduce
Install S3FS module
Unzip the AWS.zip into /sites/all/libraries/awssdk as per documentation https://git.drupalcode.org/project/s3fs/-/blob/7.x-3.x/README.txt
Enable module, enables successfully.
Attempt to access anything, shown the error.
Any insight would be greatly appreciated.
Comments
Comment #2
mcdoolz commentedSo it seems that the module is not loading because the libraries info is seeking the version of the library at the wrong line.
Comment #3
sgdev commentedTry to clear your cache first. If you added the SDK and immediately tried to load the module, it's probably not yet available in your system yet, and you'd get a "not found" error.
Comment #4
mcdoolz commentedThis block looks at line 500. The lines as of the latest SDK needs to be 520.
Comment #5
sgdev commentedThere you go, attached patch should take care of it.
Comment #6
mcdoolz commentedYay community ❤️
Comment #7
sgdev commented@mcdoolz, if the patch meets your needs you should mark it as "Reviewed & tested by the community". Thanks.
Comment #8
mikeytown2 commentedhard failure on install kinda sucks. Could we drop this from the info file
and then do the include in the .module if the library is there and the correct version is there, etc?
Comment #9
mcdoolz commentedSorry for the late response; that works 👍
Also, I agree with mikeytown2; I think having the file included within the module allows devs to provide feedback (should the file not exist), on steps the user can take to rectify the issue.
Comment #10
sgdev commented@mikeytown2, I agree the hard failure is not great, but I think this would be more involved than just moving the include and checking the library. Also, this particular problem can be avoided by using composer instead of the Libraries module.
Libraries is a bit problematic with s3fs, and is part of the reason composer was added to 3.x. There is a special function in the module to load the library, since anyone using Libraries can run into a situation where failures to load are cached, and it becomes nearly impossible to get AWS to load cleanly:
As well, since s3fs is taking over the file system and the stream wrapper replaces
public://, there's most likely going to be some type of hard failure if the library is missing. For such a solution to work seamlessly, I believe there would need to be a fallback to using the default Drupal file system.I'm certainly open to discussing further and investigating options. This issue was due to not searching far enough in the AWS file to find the version. It was previously a 500 line limit, and AWS recently adjusted their code where
const versionmoved from line 490 to 520. Setting at line 1000 should take care of this particular problem for the remainder of 7.x's life cycle.Comment #11
joshmillerYay, community seconded. Have a great holiday season, everyone!
Comment #12
mile23+1 on the fact that #5 works to take away the error.
Comment #14
ram4nd commented