NPM module - izara-middleware: Difference between revisions
mNo edit summary |
|||
Line 9: | Line 9: | ||
== Middleware components == | == Middleware components == | ||
The below components are | The below middleware components are executed in the below order: | ||
=== | === captureCorrelationIds === | ||
.. | .. | ||
=== | === integrationTests === | ||
Checks correlation ids for <syntaxhighlight lang="JavaScript" inline>intTest-tag</syntaxhighlight> which should only exist if the request was initiated by the [[Service - Integration Testing|Integration Testing]] service. | |||
If is part of an integration test then send a message to MsgOut queue with the event object. | |||
=== sampleLogging === | |||
... | ... | ||
=== | === stopInfiniteLoop === | ||
... | ... | ||
=== | === logTimeout === | ||
... | ... | ||
=== | === httpHeaderNormalizer === | ||
... | ... | ||
=== | === jsonParseBody === | ||
... | ... | ||
=== | === urlEncodeBodyParser === | ||
... | ... | ||
=== | === validator === | ||
... | ... | ||
=== | === flattenRequest === | ||
... | ... | ||
Line 49: | Line 55: | ||
=== Middleware: Debug Message === | === Middleware: Debug Message === | ||
All services will have an SNS queue deployed named MsgOut, this middleware adds a message to this queue when the middleware's LOG_LEVEL is set to DEBUG at the start of the request with the functions received request properties and at the end of the function with the final response formatted in a standard way for [[Service - Integration Testing|Integration Testing]] to process. | All services will have an SNS queue deployed named MsgOut, this middleware adds a message to this queue when the middleware's LOG_LEVEL is set to DEBUG at the start of the request with the functions received request properties and at the end of the function with the final response formatted in a standard way for [[Service - Integration Testing|Integration Testing]] to process. | ||
= Service requests = | = Service requests = |
Revision as of 08:17, 3 September 2020
Overview
Code that is shared by all services, including middleware code that executes at the beginning and end of each Lambda function and supporting code.
Middleware
The middleware that executes at the beginning and end of Lambda functions uses the Middy middleware module.
Middleware components
The below middleware components are executed in the below order:
captureCorrelationIds
..
integrationTests
Checks correlation ids for intTest-tag
which should only exist if the request was initiated by the Integration Testing service.
If is part of an integration test then send a message to MsgOut queue with the event object.
sampleLogging
...
stopInfiniteLoop
...
logTimeout
...
httpHeaderNormalizer
...
jsonParseBody
...
urlEncodeBodyParser
...
validator
...
flattenRequest
...
Middleware: Debug Message
All services will have an SNS queue deployed named MsgOut, this middleware adds a message to this queue when the middleware's LOG_LEVEL is set to DEBUG at the start of the request with the functions received request properties and at the end of the function with the final response formatted in a standard way for Integration Testing to process.
Service requests
The middleware module includes wrapped objects that manage requests sent to other AWS services, this allows the middleware to add or adjust the request in a standard way, passing on values across the lifetime of a multi-resource action.
Services
The following services are supported:
DynamoDB
..
Firehose
..
Http (API Gateway)
..
Kinesis
..
Lambda
..
SNS
..
SQS
..
Step Functions
..