aws / aws/aws-lambda-runtime-interface-emulator
Emulate API Gateway payload in event object
- Lenguaje dominante
- Go
- Estrellas
- 1.1k
- Forks
- 118
- Merge medio
- 42 min
- PR fusionados (30 d)
- 2
Descripción
We run our lambdas behind an API Gateway. The event object in the lambda when we run locally does not have the same structure as the event object when running behind an API Gateway.
For example, if I want to post to a path with the `/{model}` parameter, I need to post with this wrapping my payload
```
{
"pathParameters": {
"model": model
},
"body": { .. json payload ...}
}
```
When I call my API Gateway endpoint I do not need to wrap the payload, as this is created by API Gateway as it passes the payload off to the lambda.
What I would really like is to be able to set an ENV var such as `LAMBDA_MODE` which when set to `API_GATEWAY` RIE wraps the event to mimic the event passed by the API Gateway. It would need to work the same for response objects too. If not set, then it would work in the default mode which is how it works today.
Guía de contribución
Línea de trabajo
Empieza por rastrear cómo el emulador recibe y construye actualmente el objeto de evento y, después, inspecciona la ruta de respuesta. Compara ese comportamiento con la estructura de API Gateway descrita aquí y determina cómo la configuración LAMBDA_MODE=API_GATEWAY debería afectar tanto al procesamiento de solicitudes como al de respuestas. Se considera terminado cuando el comportamiento predeterminado permanece sin cambios y se admiten eventos y respuestas con el formato de API Gateway.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- go
- Área
- api, backend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100