This problem is related to serverless offline.
This error occurs when deploying my aplication in local with serverless offline, and calling an endpoint with an input produce a controlled error. When this error is captured a response with statuscode 400 is returned and received. Finally an error is showed and execution is stopped. The request is returning the rigth response, but I need serverless offline to stay alive.
This is the received response
{"success":false,"error":"Field not found","stacktrace":"Error: Field not found\n at getField (webpack-internal:///./src/service/FieldService.ts:46:23)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"}
This is the console output when the execution stops.
offline: (λ: AppFieldsAdder) RequestId: ckase9iyj0002herh4cjj2l47 Duration: 107807.63 ms Billed Duration: 107900 ms
[offline] _____ HANDLER RESOLVED _____
[offline] Using response 'default'
[offline] _____ RESPONSE PARAMETERS PROCCESSING _____
[offline] Found 0 responseParameters for 'default' response
[offline] headers {}
Error --------------------------------------------------
Error: Field not found
at getField (webpack-internal:///./src/service/FieldService.ts:46:23)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 12.16.1
Framework Version: 1.71.3
Plugin Version: 3.6.12
SDK Version: 2.3.1
Components Version: 2.30.11
Waiting for the debugger to disconnect...
Process finished with exit code 1
Source code
serverless.yml
plugins:
- serverless-secrets-plugin
- serverless-plugin-tracing
- serverless-pseudo-parameters
- serverless-iam-roles-per-function
- serverless-webpack
- serverless-dynamodb-local
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
AppFieldsAdder:
handler: src/handler/AppHandler.addField
timeout: 29
events:
- http:
path: /${self:custom.apiVersion}/app/{id}/field
method: post
authorizer:
arn: arn:aws:lambda:...
resultTtlInSeconds: 300
identitySource: method.request.header.Authorization
environment:
APPS_TABLE: ...
FIELDS_TABLE: ...
I just need to know how to keep the process alive. I need it for executiong my integration tests.
Environment
-
serverless
version: last version -
serverless-offline
version: last version -
node.js
version: nodejs12.x -
OS
: Ubuntu 18.04.4 LTS