1

I want to be able to read a cookie from my browser request in an aws lambda. I have found this https://aws.amazon.com/blogs/compute/simply-serverless-using-aws-lambda-to-expose-custom-cookies-with-api-gateway/ which seems to work.

However, this is not very useful in development in a aws-sam-cli application. I'm not sure how I would set this up using the SAM template format using a local server that is started with sam local start-api.

I've read through the template documentation, however I haven't found it yet. Any help would be appreciated.

Evil Buck
  • 1,068
  • 7
  • 20
  • Possible duplicate of [Using AWS Gateway API, can I access the cookies?](https://stackoverflow.com/questions/35572887/using-aws-gateway-api-can-i-access-the-cookies) AWS SAM uses API Gateway Proxy integration which is discussed in the linked question. – matsev May 14 '19 at 19:53
  • 1
    That would require setup on through the console in aws services. I don't know how that would translate into a sam template to be parsed by `sam local start-api`. I'll update the question to be more specific. – Evil Buck May 15 '19 at 20:14
  • I guess that you are referring to the [SAM quick start](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-quick-start.html)? You can still use the aws-sam-cli for development (try logging the event on the first line of your event handler in the `hello-world/app.js` file to see the request headers). That said, browsers typically don't store cookies from localhost unless you do some additional configuration. – matsev May 15 '19 at 21:26

0 Answers0