Error - "ErrorInvalidRequest"

This may happen cuz you need that all your nodes to have Type. “dgraph.type: “User”

You could use bulk upsert. But be careful.

upsert {
  query {
    v as var(func: regexp(email, /.*@company1.io$/))
  }

  mutation  {
    set {
      uid(v) <dgraph.type> "Company" .

    }
  }
}
upsert {
  query {
    v as var(func: has(user.name))
  }

  mutation  {
    set {
      uid(v) <dgraph.type> "User" .

    }
  }
}