help,there is throw a mistake.
hare2011 opened this issue · 14 comments
2017-03-31T07:41:10.167Z 6835cdb1-15e5-11e7-ae5d-7dd945e4dd5c TypeError: Cannot read property 'key' of undefined
at exports.handler.S3.getObject.promise.then.then (/var/task/index.js:9:40)
Same problem! Have no idea what is going wrong.
Hmm - are you running it through an API Gateway Lambda proxy? It appears like the query string parameters are not defined.
In my case i made a mistake setting URL
environment variable. So setting url from endpoint static website hosting of my bucket fixed problem.
@imamatory Glad you figured it out! @hare2011 Please let me know a little more about how you're running the function and definitely double check your environment variables.
@hare2011 When I hit your endpoint, it appears to be working for me. Hitting:
http://images-vamily.s3.amazonaws.com/
I can see an index of all images in your bucket. When I hit them, I can resize them. See:
http://images-vamily.s3-website-us-west-2.amazonaws.com/500x500/4.jpg
http://images-vamily.s3-website-us-west-2.amazonaws.com/300x300/4.jpg
why i access this url throw mistake.
https://0ty0msuku6.execute-api.us-west-2.amazonaws.com/prod/resize?key=300%C3%97300/5.png
great. thank you much very.
Because the x in there is some Unicode "x" and not an actual ASCII x as the sample code is attempting to match via a regular expression. See:
http://images-vamily.s3-website-us-west-2.amazonaws.com/300x300/5.png