question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Predictions - InvalidS3ObjectException

See original GitHub issue

Env : 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mlafocommented, Jun 28, 2020

@cedricgrothues - I gave a try in eu-west-1 region. It’s fixed. Predictions works with private and protected Storage. Thank a lot.

1reaction
cedricgrothuescommented, Jun 19, 2020

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:

  1. Rekognition / Textract and S3 have to be in the same region.
  2. The 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]:

res({ S3Object: { Bucket: parsedURL[1], Name: decodeURIComponent(parsedURL[2]) } });

decodeURIComponent replaces the %3A with the corresponding character (:), while the rest of the object name will stay as-is.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found