3

I am trying to read the query parameters passsed from a frontend application in my lambda function. Below is the code of frontend application

method: 'GET',
          url: API_ENDPOINT + '/detect',
          params: {
            Image: this.imageKey
          }

Below is my lambda code to read the query variable

   var params = {
      Image: {
        S3Object: {
          Bucket: process.env.UploadBucket,
          Name: event.Image
        }
      },
    };

Where I am going wrong?

0

1 Answer 1

3

Try change your lamda to read the query string like below

var params = {
  Image: {
    S3Object: {
      Bucket: process.env.UploadBucket,
      Name: event['queryStringParameters'].Image
    }
  },
};
Sign up to request clarification or add additional context in comments.

1 Comment

Thats was a quick one @rx100. That worked perfect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.