CodeGenieApp / CodeGenieApp/serverless-express

RIE instructions missing

Abierto
#659 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
5.3k
Forks
676
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

can you please add somewhere that the command to test must include (unlike "normal" lambda runtimes?) a body [like so][ref]:

```json5
{
"resource": "/",
"path": "/",
"httpMethod": "GET",
"requestContext": {
"resourcePath": "/",
"httpMethod": "GET",
"path": "/Prod/",
// ...
},
// ....
}
```

e.g.:

```
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"requestContext": {}, "path": "/", "httpMethod": "GET"}'
```

[ref]: https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html

rest of post

amazon claims that testing with the Runtime-Interface-Emulator (aka `rie`) should be possible by performing these steps:

https://github.com/aws/aws-lambda-nodejs-runtime-interface-client#local-testing

1. install rie:

```
mkdir -p ~/.aws-lambda-rie && \
curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \
chmod +x ~/.aws-lambda-rie/aws-lambda-rie
```

2. run app:
```
docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
--entrypoint /aws-lambda/aws-lambda-rie \
myfunction:latest \
/usr/local/bin/npx aws-lambda-ric app.handler
```

3. post an event:
```
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
```

this does not work with this package, because some additional fields must be present.

other commands i tried:

```
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"requestContext": {}, "path": "/"}'
```

and then finally after looking here https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html:

```
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"requestContext": {}, "path": "/", "httpMethod": "GET"}'
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Localiza la documentación existente sobre RIE o pruebas locales y compara su ejemplo de curl con los requisitos de eventos de AWS API Gateway y las indicaciones de RIE enlazadas. Actualiza la documentación con el ejemplo requerido del cuerpo de la solicitud y, después, verifica que la invocación documentada de Docker/RIE y el comando curl sean internamente coherentes.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
aws, docker, javascript, node.js
Área
documentation
Tipo de issue
Documentación
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.