aws / aws/aws-lambda-runtime-interface-emulator

Async (Event) Function Invocation Emulation?

Ouverte
#32 2 commentaires 18 réactions 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Go
Étoiles
1.1k
Forks
118
Merge moyen
42 min
PR mergées (30 j)
2

Description

Hello there! First off, thank you for making this emulator, it is really helpful for testing and development.

My question: is there a way to run the function invocation asynchronously? As far as I can tell, right now the HTTP request to the emulator results in a blocking call (i.e. no HTTP response until the function completes). This is helpful for testing the `RequestResponse` invocations, but causes issues with code using `Event` invocations (https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax).

In other words, I would expect the follow curl command to return almost immediately even if the "lambda" started takes a few minutes to complete.

```
curl -v -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -H "X-Amz-Invocation-Type: Event" -d '{}'
```

Not having this unfortunately breaks code that relies on the `Event` (async) behavior. We can of course thread/async those calls in our code, but it breaks the emulation we were hoping for.

Am I missing something, or is this indeed currently not covered by the emulator? If not covered, would a pull request to add it be welcome?

Thanks.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par reproduire la requête curl documentée contre l’émulateur, en utilisant l’en-tête X-Amz-Invocation-Type: Event et une fonction qui s’exécute pendant plusieurs minutes. Inspectez le point d’entrée d’invocation HTTP et comparez son comportement à celui de RequestResponse. Le travail est terminé lorsque Event retourne presque immédiatement tandis que la fonction continue de s’exécuter, sans modifier le comportement synchrone.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
go
Domaine
api, backend
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.