I am trying to retrieve images from Amazon S3
for my React project. However, my react project setup seems to contradict with aws-sdk which can be traced back to this post.
Therefore, I am trying to have AWS lambda
as my MiddleWare to retrieve the Image. I utilised s3.getSignedUrlPromise()
to get a signed url of the image, then pass the url back to the frontend. In the local environment, this approach works and I can render the requested image with the signed url retrieved from backend.
However, when I deployed the lambda function, the signed url reads 403 forbidden
file. Hence I believe that the signed url is bound to the domain which is localhost
. The question is, is there a way to tell getSingedUrlPromise()
which host is the signed url supposed to be bound to?
I also attempted to use s3.getObject()
api but I had a very hard time trying to convert the Buffer object to Image.