-
Notifications
You must be signed in to change notification settings - Fork 186
Move AWS to middleware #9559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move AWS to middleware #9559
Conversation
d5c8cc9
to
c6253b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driusan I have the following error when I pull the code on my HBCD VM:
[Thu Feb 13 20:31:26.611174 2025] [php:notice] [pid 1555773] [client 10.20.13.136:56208] [CRITICAL] /var/www/loris/src/AWS/Client.php:21: Uncaught TypeError: LORIS\\AWS\\Client::__construct(): Argument #1 ($loris) must be of type LORIS\\LorisInstance, null given, called in /var/www/loris/src/Middleware/AWS.php on line 38 and defined in /var/www/loris/src/AWS/Client.php:21\nStack trace:\n#0 /var/www/loris/src/Middleware/AWS.php(38): LORIS\\AWS\\Client->__construct()\n#1 /var/www/loris/src/Middleware/ContentLength.php(53): LORIS\\Middleware\\AWS->process()\n#2 /var/www/loris/htdocs/index.php(75): LORIS\\Middleware\\ContentLength->process()\n#3 {main}\n thrown
I checked and we are not overriding the AWS section.
2598074
to
490675e
Compare
This refactors the way AWS S3 buckets are handled so that the stream wrapper registration is added by a middleware. For scripts, the logic of registering a stream wrapper is moved to generic_includes. This is a first pass at addressing the comment in htdocs/index.php that most of the work of NDB_Client should be done by middleware.
3c3b0ef
to
26c3066
Compare
@driusan now I get the following errors:
|
Hi @driusan, So @jeffersoncasimir mentioned that he will be reviewing this PR as he figured out his minio account issues with IT and has raisinbread data set ready on his end. Thanks. |
I have attempted to test this with MinIO and here are my issues. I get the following error message:
Does anyone know why the region is set to empty string instead of I can bypass this error by setting a region. However, this next issue makes it untestable. By performing the test below below I get this error:
This is because the library is assuming a "DNS-style bucket+hostname:port", while our MinIO structure is currently "hostname:port/bucket"
|
@jeffersoncasimir It is set to the empty string for exactly that reason. You use either the region or the hostname for the client. |
The constructor is saying that region is required. Should I request from IT that the expected bucket+hostname:port structure resolves correctly? |
Hm.. no, that's weird. It should work. It works with the current NDB_Client, and all I did was move the code around. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have managed to find a configuration that works for my MinIO bucket. See #9579.
I approve this PR given that I have successfully tested and confirmed the following:
- The
LORIS-S3-Enabled
header gets added - I am able to fetch a file from my bucket using
LORIS\AWS\Client
from a script usinggeneric_includes.php
This refactors the way AWS S3 buckets are handled so that the stream wrapper registration is added by a middleware. For scripts, the logic of registering a stream wrapper is moved to generic_includes.
This is a first pass at addressing the comment in htdocs/index.php that most of the work of NDB_Client should be done by middleware.