-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Aws::Xml::Parser::ParsingError
when listing objects
#3111
Comments
What XML gem are you using? (You can determine which xml "engine" is used at runtime with: Any idea what prefixes might be causing an issue? Do you have any unusual object names in the bucket you're trying to list for? Does this happen everytime (accounting for paging) or are you able to successfully get all pages of the response sometimes? |
Wow, that was fast :)
It happens every time, but only for a certain page probably. Unfortunately I have no idea how to retrieve any further information, all I have is the continuation token. And yes, it is possible there is some unusual character in the object name, it is happening for at least two files (unfortunately I don't know which ones). |
I'm trying to reproduce this, but haven't been able to figure out what characters might be responsible yet. A few things that might help:
|
Awesome, thanks. Now I can see that it is probably because of a corrupted filename. This would be the problematic object: <Contents>
<Key>
room-tyj62m1bnw14/storage/files/2022/07/16/C1WECz5UQ8Xw82vzd7yZj8/\xEF\xBF\xBD\xEF\xBF\xBDo\xEF\xBF\xBDu\xEF\xBF\xBD]onf\xEF\xBF\xBDI\xDC\x99\xD6\xB3\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBDN.r\n\xEF\xBF\xBD</Key>
<LastModified>2024-09-10T09:00:16.000Z</LastModified>
<ETag>"be2142edba71363ab371527b7865056c"</ETag>
<Size>86623</Size>
<StorageClass>STANDARD</StorageClass>
</Contents> However I can download the file (with the corrupted filename) from S3 console with no issue. So I'm not sure what is the right approach to this. |
Can you try using a different XML gem? I believe there are differences in what the underlying xml parsers consider valid |
May be related to #3081 |
Well, that will be a little bit complicated but I'll try. |
What specifically is complicated? You should just be able to add the 'ox' gem to your gemfile and the SDK will prefer it. |
@mullermp Our production deployment pipeline :) @alexwoods so I tried with Ox and it seems to work just fine, the response (object key) is the same. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
OK, so does this mean it is a "bug" in Nokogiri and the solution is to use another XML parser? |
I don't know if it's a bug or not but it's in a grey area for sure. Some parsers think it's invalid and others don't. I think nokogiri is just more strict on that specification. This isn't the first time we've seen this. S3 doesn't strictly follow xml rules either. In either case I would maybe consider adding validation to prevent file names having invalid characters. |
Describe the bug
I get
Aws::Xml::Parser::ParsingError
error when listing objects using#list_objects_v2
.Regression Issue
Expected Behavior
It works.
Current Behavior
It throws the error:
Reproduction Steps
Unable to figure out how to reproduce. It happens just for some prefixes, could be related to filenames.
Possible Solution
No response
Additional Information/Context
No response
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-s3 1.160.0
Environment details (Version of Ruby, OS environment)
Ruby 3.2.5, Alpine 3.20
The text was updated successfully, but these errors were encountered: