sbarski / serverless-architectures-aws

The code repository for the Serverless Architectures on AWS book
http://book.acloud.guru
MIT License
156 stars 99 forks source link

Multiple custom authorizers are required after implementing s3-policy-document in chapter 8 #12

Open pault2k14 opened 6 years ago

pault2k14 commented 6 years ago

Per the documentation for custom authorizers the policy document returned from from the custom authorizer is for the ENTIRE API. I would have thought disabling caching in the custom authorizer would have solved this issue, however it doesn't seem to, in any case disabling caching isn't recommended for custom authorizes for performance reasons (always calling at least 2 lambdas). My solution was to implement different custom authorizers for each endpoint. Some of these issues are discussed here https://forums.aws.amazon.com/thread.jspa?threadID=225934&tstart=0