unee-t / lambda2sqs

Relays SQL triggered payloads to MEFE via a queue
https://ap-southeast-1.console.aws.amazon.com/lambda/home?region=ap-southeast-1#/applications/lambda2sqs
GNU Affero General Public License v3.0
0 stars 4 forks source link

MEFE API - user creation #10

Closed kaihendry closed 5 years ago

kaihendry commented 5 years ago

Related to #9, Example payload:

{
    "actionType": "CREATE_USER",
    "creatorId": "R4vBD6BZRCNx8JwnM",
    "emailAddress": "naor0example.com",
    "firstName": "Naor",
    "lastName": "Biton",
    "phoneNumber": "28282828"
}

To proceed need:

franck-boullier commented 5 years ago

Once the API has returned a success, the SQL to update the 'upstream' system is

SET @user_creation_request_id= 'userCreationRequestId'; SET @mefe_user_id= 'userId (from_API_response)'; SET @creation_datetime = 'timestamp (from_API_response)'; SET @is_created_by_me = 0; CALL ut_creation_success_mefe_user_id;

SET @user_creation_request_id= 'userCreationRequestId'; SET @mefe_user_id= 'userId (from_API_response)'; SET @creation_datetime = 'timestamp (from_API_response)'; SET @is_created_by_me = 1; CALL ut_creation_success_mefe_user_id;

franck-boullier commented 5 years ago

The Test:

In the DEV/Staging environment: Create a new person in the Unee-T Enterprise database (user email derp@derp.com)

Expected result:

If Email does not exist in Mongo

If Email already exists in Mongo:

Actual result:

@kaihendry any idea what might be happening?

kaihendry commented 5 years ago

Sorry, somehow missed this. It's not implemented yet. Working on it now.

franck-boullier commented 5 years ago

The Test:

In the DEV/Staging environment: Create a new person in the Unee-T Enterprise database user 21

Expected result:

If Email does not exist in Mongo

If Email already exists in Mongo:

Actual result:

@kaihendry any idea what might be happening?

franck-boullier commented 5 years ago

Latest Test worked as expected: user is created in MEFE and BZFE It is possible to access the MEFE after resetting the password for the user Well done @kaihendry and @nbiton 🎉 !!!

franck-boullier commented 5 years ago

Re-opening this as there was some unexpected errors:

The Test:

Done in the DEV/Staging

Actual result:

Only 14 of the 30 users have a MEFE user ID 16 records have NOT been processed

@kaihendry any idea what might have gone wrong?

kaihendry commented 5 years ago

I'm getting 400 errors from the MEFE with [[object Object]] as the response. So I need @nbiton to look into this.

nbiton commented 5 years ago

Seems to be caused by requests that include email addresses for users who are already BZ users, but not registered to MEFE

franck-boullier commented 5 years ago

Seems to be caused by requests that include email addresses for users who are already BZ users, but not registered to MEFE

That's probably the right explanation How an we fix that?

franck-boullier commented 5 years ago

The Test:

Done in the DEMO Environment

Actual result:

NO user have been created

@kaihendry any idea what might have gone wrong?

franck-boullier commented 5 years ago

After fixing the issues described in https://github.com/unee-t/bz-database/issues/120

The Test:

Done in the DEMO Environment

Actual result:

NO user have been created

@kaihendry any idea what might have gone wrong?

kaihendry commented 5 years ago

https://ap-southeast-1.console.aws.amazon.com/cloudwatch/home?region=ap-southeast-1#logEventViewer:group=/aws/lambda/alambda_simple;start=PT5M logs showed there was a timeout due to VPC connectivity which was fixed by 3e752acdc6e27e96e9515f87e092eb3336b9d26d

franck-boullier commented 5 years ago

After fixing the timeout issue in AWS

The Test:

Done in the DEMO Environment

User creation mechanism now seems to work on the DEV and in the DEMO environment.