Skip to content

Mocking a Cloudfront Lamda@Edge event using start-api #352

@hmgibson23

Description

@hmgibson23

This is really a question.

Is it possible to mock a Lambda@Edge event when running the lamdba through an api.

So my lambda expects something like:

{ "Records": [
    {
      "cf": {
        "config": {
            ...
        },
        "request": {
          "headers": {
              ...
          },
          "origin": {
              ...
          }
        },
        "response": {
          "status": "200",
          "statusDescription": "OK",
          "headers": {
              ...
          }}}}]}

I can pass along a mock event if calling the lamda directly: sam local <lambda> -e event.json but if I make the request through the api, a GET (or whatever) event is passed and the lamdba fails and returns null (as I've told it to), but this breaks the start-api. So, basically, can I mock the cf event when it's running as an api?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions