Cognito migration lambda doesn't assign Username correctly

When we run user migration lambda and try setting to the username attribute a custom value (our own generated uuid) it doesn’t assign it to that top-level Username field, but adds a username attribute.

const handler = async (event) => {
  if (event.triggerSource == "UserMigration_Authentication") {
    const user = authenticateUser(event.userName, event.request.password);
    if (user) {
      event.response.userAttributes = {
        username: 'custom_username_goes_here',
      };
      event.response.finalUserStatus = "CONFIRMED";
      event.response.messageAction = "SUPPRESS";
    }
  }

As a result in the live environment the top-level Username field is set to our custom value, Attributes list has no changes. In the Localstack environment, the top-level Username field is set to some cognito-generated uuid, and a username field is added to the Attributes section.

A fix for this issue has been pushed to the last image of LocalStack. You can update your image by running localstack update docker-images or docker pull localstack/localstack:latest