CodeGenieApp / CodeGenieApp/serverless-express

RIE instructions missing

Aperta
#659 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
5.3k
Fork
676
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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"}'
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Individua la documentazione esistente su RIE o sui test locali e confronta il relativo esempio curl con i requisiti degli eventi AWS API Gateway e con le indicazioni RIE collegate. Aggiorna la documentazione con l’esempio richiesto del corpo della richiesta, quindi verifica che l’invocazione Docker/RIE e il comando curl documentati siano internamente coerenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, docker, javascript, node.js
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.