CodeGenieApp / CodeGenieApp/serverless-express
RIE instructions missing
- Langage dominant
- JavaScript
- Étoiles
- 5.3k
- Forks
- 676
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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"}'
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Repérez la documentation existante sur RIE ou les tests locaux et comparez son exemple curl aux exigences des événements AWS API Gateway ainsi qu’aux indications RIE liées. Mettez à jour la documentation avec l’exemple requis du corps de la requête, puis vérifiez que l’invocation Docker/RIE et la commande curl documentées sont cohérentes entre elles.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- aws, docker, javascript, node.js
- Domaine
- documentation
- Type d'issue
- Documentation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 55/100