hfaran / slack-export-viewer

A Slack Export archive viewer that allows you to easily view and share your Slack team's export
https://pypi.python.org/pypi/slack-export-viewer
MIT License
939 stars 194 forks source link

500 Internal Server Error #96

Closed JOE-DCG closed 5 years ago

JOE-DCG commented 5 years ago

Installed the newest Python for Windows on 2 machines. Both failing with the 500 Internal Server Error again when running slack-export-viewer.

IndexError: list index out of range

hfaran commented 5 years ago

Please post the full stacktrace. It's impossible to debug with information this limited.

k-spit commented 5 years ago

I ran into the same issue as @JOE-DCG.

`ubuntu@ubuntu:~/slack-export$ slack-export-viewer -z slack_export.zip/tmp/_slackviewer/6081d0fe198607ec79321dde75e9aca4f2546d77 already exists

hfaran commented 5 years ago

@k-spit Two options to help debug here:

1) Please paste/upload the contents of your channels.json from the archive here so I can take a look, or 2) Add a breakpoint here to see what's happening when your channels are attempted to be loaded

I can confirm everything works fine from an archive I just tested so will need to inspect at least channels.json from your archive to see what's up.

k-spit commented 5 years ago

Here is the content of my channels.json from the archive. Because it is a company account, I had to anonymize values. Hope this does not matter.

[ { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" }, { "id": "anon", "name": "anon", "is_channel": "anon", "created": "anon", "is_archived": "anon", "is_general": "anon", "unlinked": "anon", "creator": "anon", "name_normalized": "anon", "is_shared": "anon", "is_org_shared": "anon", "is_member": "anon", "is_private": "anon", "is_mpim": "anon", "members": "anon", "topic": "anon", "purpose": "anon", "previous_names": "anon", "num_members": "anon" } ]

karlding commented 5 years ago

I bisected this, and it seems like this is due to the change introduced in #93.

 → TITANIC@slack-export-viewer (master) $ git co 22944173e2d87d3b8f9f71924f1ed2bc3abaa944
Note: checking out '22944173e2d87d3b8f9f71924f1ed2bc3abaa944'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 2294417 Add release instructions
(slack-export-viewer)
 → TITANIC@slack-export-viewer ((2294417...)) $ git bisect start
(slack-export-viewer)
 → TITANIC@slack-export-viewer ((2294417...)|BISECTING) $ git bisect good
(slack-export-viewer)
 → TITANIC@slack-export-viewer ((2294417...)|BISECTING) $ git co master
Previous HEAD position was 2294417 Add release instructions
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
(slack-export-viewer)
 → TITANIC@slack-export-viewer (master|BISECTING) $ git bisect bad
Bisecting: 2 revisions left to test after this (roughly 2 steps)
[57d25d708ebb34ef4ab0e983773f30f938172e0d] show emoji bare name test like :+1:
(slack-export-viewer)
 → TITANIC@slack-export-viewer ((57d25d7...)|BISECTING) $ git bisect good
Bisecting: 0 revisions left to test after this (roughly 1 step)
[43fe2aa490393d1be459bc032009e49d318e5f85] add missing import, fixes regression in reaction handling (#92)
(slack-export-viewer)
 → TITANIC@slack-export-viewer ((43fe2aa...)|BISECTING) $ git bisect good
90ca642551d8d907125ab4a09f7e97bfc1dfd72d is the first bad commit
commit 90ca642551d8d907125ab4a09f7e97bfc1dfd72d
Author: Lukas Kahwe Smith <smith@pooteeweet.org>
Date:   Tue Jan 15 21:44:07 2019 +0100

    added 'channels', 'no-sidebar' and 'no-external-references' options (#93)

:100644 100644 3aa0e30d52d70c5c52ef279e3f3d5c1c1e9c4bfa 3847d58c271e7c17c44edd696374af66a23bf042 M      README.md
:040000 040000 ea48496e7465cdccdef4f1741dbc10dde005bbf5 3c773b20916615f025f0736443ecdee66e159621 M      slackviewer

If I revert this commit (90ca642551d8d907125ab4a09f7e97bfc1dfd72d) it works as expected.

The problem is because channels is always an instance of a str due to the way the argument is passed in. As such, it takes on the default value from here:

@click.option('--channels', type=click.STRING,
              default=envvar("SEV_CHANNELS", ''),
              help="A comma separated list of channels to parse.")
hfaran commented 5 years ago

@karlding to confirm, your new PRs fix this issue, correct?

karlding commented 5 years ago

Yes, this should be fixed by #98.