dimkir / aws-multitenant-architecture-quickstart

Serverless port for AWS Multi Tenant Architecture Concept (check website)
https://www.slideshare.net/AmazonWebServices/deconstructing-saas-a-deep-dive-into-building-multitenant-solutions-on-aws-arc407-reinvent-2017
0 stars 0 forks source link

(order-manager) has global `tenantId` var which is prone to race condition #25

Closed dimkir closed 5 years ago

dimkir commented 5 years ago

Tenant Id needs to be extracted within body of each controller function!

image

dimkir commented 5 years ago

This bug seems to apply in

On Lambda this error cannot happen, as each request will run in separate lambda container and reentry of multiple requests into middleware within same memory space cannot happen

dimkir commented 5 years ago

But we get another issue:

Middleware is declared within server.js which is outside of the scope of the (order-manager). This is why we cannot set global tenantId variable there... (or at least this would be a very perverted way).

We still need to extract tenantId from each request within the bodies of the controller functions... (or maybe we can inject this value into request?)

dimkir commented 5 years ago

This is fixed