So, is it possible to continue to process a request after the client response has been sent?
I have an serverless API, and one of its request takes usually 10-18 seconds to finish, and always returns 200, so what I wanted to do is send 200 to the client as soon as the request comes, and then actually handle the request. WHen I coded like this, it worked fine on serverless offline, but when I deployed it on aws lambda, it ended the request right after returning the 200.
I’m sorry if this is something dumb, but I searched everywhere and can’t find an answer.
Here is my serverless.yml
org: my org
app: streetprogram ming-ploomes-esta f-app
service: streetprogramming-ploomes-estaf
provider:
name: aws
runtime: nodejs12.x
timeout: 30
memorySize: 512
environment:
PLOOMES_USER_KEY: ${file(env.yml):PLOOMES_USER_KEY}
D4_SIGN_TOKEN_API: ${file(env.yml):D4_SIGN_TOKEN_API}
D4_SIGN_CRYPT_KEY: ${file(env.yml):D4_SIGN_CRYPT_KEY}
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:*"
Resource:
- ""
functions:
ploomesChangeStageWebhook:
handler: src/ploomesChangeStageWebhook.handler
events:
- http:
path: ploomesChangeStageWebook
method: post
d4signOnDoneWebhook:
handler: src/d4signOnDoneWebhook.handler
events:
- http:
path: d4signOnDoneWebhook
method: post
plugins:
- serverless-offline