mattermost-plugin-gitlab: Encountered an error getting your to do items
After setting up the plugin everything works fine except the todo function.
When calling /gitlab todo
I get Encountered an error getting your to do items
in the UI.
In the Mattermost log the plugin is throwing two errors almonst every minute:
{"level":"error","ts":1587731687.333412,"caller":"mlog/sugar.go:23","msg":"can't get todo in command","plugin_id":"com.github.manland.mattermost-plugin-gitlab","err":"can't list todo in GitLab api: json: cannot unmarshal string into Go struct field TodoTarget.target.id of type int"}
| {"level":"error","ts":1587731600.044075,"caller":"mlog/sugar.go:23","msg":"unable to list unreads in GitLab API","plugin_id":"com.github.manland.mattermost-plugin-gitlab","err":"can't list todo in GitLab api: json: cannot unmarshal string into Go struct field TodoTarget.target.id of type int"}
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 18 (5 by maintainers)
Hi @aelgasser, thanks so much for this thorough explanation. We can certainly ship a fix with the latest
go-gitlab
version once this is fixed in that library. Thanks again for the full context and resolution here 👍 cc @hanzei@DHaussermann, @levb, @mickmister, @manland we were experimenting with the plugin at my workplace and encountered this issue as well. After digging into the code and dependencies (more precisely
go-gitlab
), I found that this comes from the issue described here https://github.com/xanzy/go-gitlab/issues/1743To summarize, gitlab is supposed to return an
int
id for targets of todos but instead returns a commit sha as a string when the target is a commit (it happens when your todo item is a comment on a commit for example).The team at
go-gitlab
fixed the problem by putting a workaround while Gitlab still has the issue open (see https://gitlab.com/gitlab-org/gitlab/-/issues/416180). But they introduced a typo which needs to be fixed (see https://github.com/xanzy/go-gitlab/pull/1744#issuecomment-1917573203).I see that the latest release of the mattermost plugin stil uses the version 0.55.0 of go-gitlab.
Can you update to the latest version (now it 0.96.0 but still has the problem) once they fix the typo?
And to all the commenters above, you are seeing that sometimes it works and sometimes not because it happens only when you receive a comment in Gitlab from someone who wrote it on a commit (see my test here)
Hi @aelgasser, we have a release in process and are including this fix in the release. I’m thinking this will be released next week. I’ll keep you updated. Thanks again
Hi @mickmister the issue has just been fixed in go-gitlab in their 0.97.0 release (https://github.com/xanzy/go-gitlab/pull/1744#issuecomment-1925326400, https://github.com/xanzy/go-gitlab/releases/tag/v0.97.0)