mattermost / mmetl

9 stars 24 forks source link

Errors running 'mmetl transform slack' #22

Open mkdbns opened 2 years ago

mkdbns commented 2 years ago

We were following the Slack migration guide. Running step:

  1. Convert Slack Import to Mattermost Bulk Export Format ./mmetl transform slack --team <TEAM NAME> --file export-with-emails-and-attachments.zip --output mattermost_import.jsonl

mmetl reports numerous errors similar to the following:

2022/08/29 15:07:31 User googledrive does not have an email address in the Slack export. Used googledrive@example.com as a placeholder. The user should update their email address once logged in to the system.

2022/08/29 15:07:31 Slack Import: Unable to import the message as its type is not supported. post_type=message post_subtype=thread_broadcast

2022/08/29 15:07:32 Slack Import: Unable to import the message as its type is not supported. post_type=message post_subtype=group_join

2022/08/29 15:07:32 Slack Import: Unable to add the message as the Slack user does not exist in Mattermost. user=U027TGQAFTL

2022/08/29 15:07:32 ERROR processing post in thread, couldn't find rootPost: {User:UKT0QMPRN BotId: BotUsername: Text:this ?

mkdbns commented 2 years ago

from @svelle

I knew this issue sounded familiar. I actually started writing a patch for this error a couple years back https://github.com/mattermost/mmetl/pull/6/files for several reasons the changes never made it into mmetl but my changes are still available on GH so feel free to use them in case you want to build a patch for this.

basically the issue is that slack does not create bot users for any bots in the export but references their user/bot-id which in turn causes mmetl to error out because it finds a message with no user attached to it. I think if you ignore this all that happens is that those messages will be missing from the export, however there's some customers for whom this wouldn't be an option.

My patch did a first pass before any conversions happened to fetch all user ids in the posts lists and checked if there's a userid existing in the users.json. If that wasn't the case it created a intermittent user that got a generic username which could then accept all the bot posts.