Predictions - InvalidS3ObjectException
See original GitHub issueEnv : React-native “aws-amplify”: “^3.0.8”, “aws-amplify-react-native”: “^4.0.4”, “react”: “16.11.0”, “react-native”: “0.62.2”,
Predictions configuration for Amplify.configure() : predictions: { identify: { identifyText: { proxy: false, region: “us-east-1”, defaults: { format: “ALL” } } }
Issue : When I user Predictions with S3 object, it returns an InvalidS3ObjectException. “Unable to get object metadata from S3” However when I use Storage on the same file, everything works fine.
My code - pretty simple :
await Predictions.identify({
text: {
source: {
key: "myFile.jpeg",
level: "public"
},
format: "PLAIN"
}
})
.then((res) => setPrediction(JSON.stringify(res, null, 2)))
.catch((err) =>
setPrediction("Predictions error : " + JSON.stringify(err, null, 2))
);
}
My succeeded Storage code :
Storage.get("myFile.jpeg")
.then((res) => setPrediction(JSON.stringify(res, null, 2)))
.catch((err) => "Storage error : " + JSON.stringify(err, null, 2));
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
InvalidS3ObjectException (AWS SDK for Java - 1.12.312)
... com.amazonaws.services.fms.model · com.amazonaws.services.forecast · com.amazonaws.services.forecast.model · com.amazonaws.services.forecastquery ...
Read more >botocore.errorfactory.InvalidS3ObjectException: - Stack Overflow
when calling the CompareFaces operation: Unable to get object metadata from S3. Check object key, region and/or access permissions In my case ...
Read more >AWS SDK for Kotlin API Reference
Link copied to clipboard. forecast. Link copied to clipboard. forecastquery. Link copied to clipboard. frauddetector. Link copied to clipboard.
Read more >Rekognition - Go Packages
func (s *InvalidS3ObjectException) Code() string ... Using Amazon Rekognition to make gender binary predictions is best suited for use cases where aggregate ...
Read more >Questions tagged with Amazon Rekognition - AWS re:Post
How to improve Rekognition Content Moderation model? · Rekognition custom labels "No predictions for this image" instead of "False Negative" · Negative values...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cedricgrothues - I gave a try in eu-west-1 region. It’s fixed. Predictions works with private and protected Storage. Thank a lot.
Ok, I just had a look, and it seems like @mlafo and @onlybakam are right, this issue describes two different “problems” that both cause an
InvalidS3ObjectException
:Rekognition
/Textract
andS3
have to be in the same region.S3Object
name, extracted from the object URL, is still percent-encoded.While the first “problem” seems to be by design, the second one describes a bug that should be an easy fix by decoding
parsedURL[2]
:decodeURIComponent
replaces the%3A
with the corresponding character (:
), while the rest of the object name will stay as-is.