Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PR subscription error "You cannot update an existing Post" #754

Closed
mickmister opened this issue Mar 21, 2024 · 3 comments · Fixed by #755
Closed

Fix PR subscription error "You cannot update an existing Post" #754

mickmister opened this issue Mar 21, 2024 · 3 comments · Fixed by #755

Comments

@mickmister
Copy link
Member

There's an issue in the pull request event webhook logic where we reuse the same post struct for multiple calls to CreatePost, resulting in this error:

CreatePost: You cannot update an existing Post.

https://community.mattermost.com/core/pl/wzjmxwip4tyapm67x6de9ff6zr

@cpatulea
Copy link
Contributor

We're having the same issue. Two channels subscribed to the same Repository:

{
  "Repositories": {
    "foulab/": [
      {
        "ChannelID": "kh<snip>fa",
        "CreatorID": "j5<snip>wo",
        "Features": "pushes",
        "Flags": {
          "ExcludeOrgMembers": false,
          "RenderStyle": "",
          "ExcludeRepository": null
        },
        "Repository": "foulab/"
      },
      {
        "ChannelID": "wn<snip>5c",
        "CreatorID": "j5<snip>wo",
        "Features": "pushes",
        "Flags": {
          "ExcludeOrgMembers": false,
          "RenderStyle": "",
          "ExcludeRepository": null
        },
        "Repository": "foulab/"
      }
    ],

results in this error logs every time:

{"timestamp":"2024-05-28 19:35:33.262 -04:00","level":"warn","msg":"Error webhook post","caller":"app/plugin_api.go:979","plugin_id":"github","post":"&{Id:e1<snip>xh CreateAt:1716939333153 UpdateAt:1716939333153 EditAt:0 DeleteAt:0 IsPinned:false UserId:sz<snip>6w ChannelId:wn<snip>5c RootId: OriginalId: Message:\n[str4w](https://github.com/str4w) pushed [2 new commits](https://github.com/FOULAB/DrawingMachines/compare/192bfbab2164...179c374f834d) to [\\[FOULAB/DrawingMachines:plotter.writeup\\]](https://github.com/FOULAB/DrawingMachines/tree/plotter.writeup):\n[`24d863`](https://github.com/FOULAB/DrawingMachines/commit/24d863f4de73d4a861380d2796c507ab4a2a0f05) Switch the chipotle3 url back to upstream\n\nThe PR has been merged by upstream - 0x5c\n[`179c37`](https://github.com/FOULAB/DrawingMachines/commit/179c374f834defced2c8be08d9dec2285e7d36f4) Merge pull request #2 from 0x5c/fix/chipotle-url\n\nSwitch the chipotle3 url back to upstream - strawdog\n MessageSource: Type:custom_git_push propsMu:{w:{state:0 sema:0} writerSem:0 readerSem:0 readerCount:{_:{} v:0} readerWait:{_:{} v:0}} Props:map[from_bot:true from_plugin:true] Hashtags: Filenames:[] FileIds:[] PendingPostId: HasReactions:false RemoteId:<nil> ReplyCount:0 LastReplyAt:0 Participants:[] IsFollowing:<nil> Metadata:<nil>}","error":"CreatePost: You cannot update an existing Post."}

One of the subscribed channels (incidentally, that's a PM with me) gets the notification; the other channel does not.

I see there's a PR #755 open to fix this. Really looking forward to it being merged and included in a release!

@cpatulea
Copy link
Contributor

Hello, I'm wondering if there will be a release soon (https://github.com/mattermost/mattermost-plugin-github/releases) that includes the fix for this issue?

@cpatulea
Copy link
Contributor

cpatulea commented Jul 3, 2024

Looks like v2.3.0 was just released yesterday: https://github.com/mattermost/mattermost-plugin-github/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants