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

TypeError: Cannot read property 'message' of null #8

Open dimkir opened 5 years ago

dimkir commented 5 years ago

When (system-registration) calls (user-manager), we got this error:

Request

request:{
   debugId:2,
   uri:'http://127.0.0.1:3001/user/system',
   method:'POST',
   headers:{
      'content-type':'application/json',
      host:'127.0.0.1:3001',
      accept:'application/json',
      'content-length':281
   },
   body:'{"tenant_id":"SYSADMIN1d08663fb6864681a7f4e94aedf1695a","companyName":"Dimitry Inc companyName","accountName":"Dimitry Inc accountName","ownerName":"dimkir+owner@gmail.com","email":"dimkir+owner@gmail.com","userName":"dimkir+owner@gmail.com","firstName":"Dimitry","lastName":"Kir"}'
}
}

Response

{
   response:{
      debugId:2,
      headers:{
         'x-powered-by':'Express',
         'access-control-allow-origin':'*',
         'access-control-allow-methods':'GET, POST, OPTIONS, PUT, PATCH, DELETE',
         'access-control-allow-headers':'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With',
         'content-type':'text/html; charset=utf-8',
         'content-length':'36',
         etag:'W/"24-yabUV3rk7osPGW0/CT8/8qlMDSo"',
         date:'Fri, 02 Nov 2018 15:39:14 GMT',
         connection:'close'
      },
      statusCode:400,
      body:'Error provisioning system admin user'
   }
}

Error messages

(node:26110) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'message' of null
    at /home/mars/phil/app/saas-quickstart-lambda/functions/system-registration.js:71:87
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
(node:26110) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
dimkir commented 5 years ago

image

dimkir commented 5 years ago
"Missing region in config"

error is thrown downstream:

image

dimkir commented 5 years ago

So the problem is due the the fact that (cognito-user):createUserPool() creates instance of AWS.CISP and tries to read region from configuration.

image

But this dev configuration is missing region setting:

image

dimkir commented 5 years ago

The actual issue in the title, is related to two problems: