Skip to content

Error: RIE Gateway expects a cookies fields in the responses #4

Description

@c-gabdalla

Hello!

I have a lambda that is served using RIE, which was set up using the following docker-compose.yaml:

version: '2.4'

services:
  # https://github.com/eagletmt/aws-lambda-rie-gateway
  apigw:
    image: public.ecr.aws/eagletmt/aws-lambda-rie-gateway
    environment:
      TARGET_URL: http://app:8080
    ports:
      - 8080:8080

  app:
    image: drift_checker
    build: drift_checker
    working_dir: /usr/src
    mem_limit: 128m
    cpus: 0.2

And with the following code:

def handler(event, context):
    return {
        "statusCode": 200,
        "headers": {
            "Content-Type": "application/json"
        },
        "body": {}
    }

The following error is returned:

src-apigw-1  | 2022-11-11T22:39:57.504677Z  INFO aws_lambda_rie_gateway: Send upstream request: {"version":"2.0","routeKey":null,"rawPath":"/","rawQueryString":null,"cookies":null,"headers":{"host":"docker:8080","user-agent":"curl/7.82.0","accept":"*/*","content-length":"197","content-type":"application/x-www-form-urlencoded"},"queryStringParameters":{},"pathParameters":{},"requestContext":{"routeKey":"$default","accountId":"","stage":"$default","requestId":"","authorizer":null,"apiId":"","domainName":"","domainPrefix":"","time":"11/Nov/2022:22:39:57 +0000","timeEpoch":1668206397504,"http":{"method":"POST","path":"/","protocol":"HTTP/1.1","sourceIp":null,"userAgent":null},"authentication":null},"stageVariables":{},"body":"[REDACTED]","isBase64Encoded":true}
src-apigw-1  | 2022-11-11T22:40:03.685465Z ERROR aws_lambda_rie_gateway: error decoding response body: missing field `cookies` at line 1 column 3369

Of course, if I change the implementation to include a cookies field in the response, it works flawlessly =D

Now, I don´t know if there is documentation describing how each response interface should be treated, but I would like to suggest making cookies an optional attribute.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions