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

Discord Webhook Error 400 #34027

Open
Bovive opened this issue Mar 26, 2025 · 9 comments · May be fixed by #34084
Open

Discord Webhook Error 400 #34027

Bovive opened this issue Mar 26, 2025 · 9 comments · May be fixed by #34084
Labels
good first issue Likely to be an easy fix issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@Bovive
Copy link

Bovive commented Mar 26, 2025

Description

After updating Gitea my Discord notifications no longer work. I did not change any configuration in Gitea or on Discord. I am able to send a curl test message to my webhook. Sending a test message to my webhook gives the following response:

Error 400

Headers:

Alt-Svc: h3=":443"; ma=86400
Cf-Cache-Status: DYNAMIC
Cf-Ray: 925921e2cbde29f4-ORD
Connection: keep-alive
Content-Length: 17
Content-Security-Policy: frame-ancestors 'none'; default-src https://o64374.ingest.sentry.io; report-to csp-sentry; report-uri https://o64374.ingest.sentry.io/api/5441894/security/?sentry_key=8fbbce30bf5244ec9429546beef21870&sentry_environment=stable
Content-Type: application/json
Date: Mon, 24 Mar 2025 21:06:26 GMT
Nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=gv0YKk7DZRkzLUeOeIIe3DjLqo96N0rsQfe4HnAkZSz8HNyPhcArpL1IaW0D5WmklGjL84m8CW9i7iO1KsYn09pp1zP5St6ckyP%2BdZEHc%2FGG51Codu%2FkTQTcCsBk"}],"group":"cf-nel","max_age":604800}
Reporting-Endpoints: csp-sentry="https://o64374.ingest.sentry.io/api/5441894/security/?sentry_key=8fbbce30bf5244ec9429546beef21870&sentry_environment=stable"
Server: cloudflare
Set-Cookie: __dcfduid=d9524f7808f311f082f06270192b2772; Expires=Sat, 23-Mar-2030 21:06:26 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax,__sdcfduid=d9524f7808f311f082f06270192b2772f32aae96089add0fd9912b677ae84ac499c730e6dedb0e58c75c39d5a9e0c551; Expires=Sat, 23-Mar-2030 21:06:26 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax,__cfruid=e1415af9c0b0b3005bfc12025dbb9c5c3c2961eb-1742850386; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None,_cfuvid=t7_yGkV4LQLMJiX4rKOzBaoFyCSRCsOz_gWkGQ0xl2k-1742850386495-0.0.1.1-604800000; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Via: 1.1 google
X-Content-Type-Options: nosniff
X-Ratelimit-Bucket: 3d2712a9e4fe17cc9d3fed4a8e672e5f
X-Ratelimit-Limit: 5
X-Ratelimit-Remaining: 4
X-Ratelimit-Reset: 1742850387
X-Ratelimit-Reset-After: 1

Body:

{"embeds": ["0"]}

I tried deleting the webhook in Gitea and recreating it but now when I click "Test Delivery" nothing happens and there is nothing in "Recent Deliveries".

Edit: On further investigation it appears to be broken when changing the trigger from Push Events to Custom Events. My only marked Custom Event is "Release".

Gitea Version

1.23.6

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker

Database

None

@wxiaoguang
Copy link
Contributor

Edit: On further investigation it appears to be broken when changing the trigger from Push Events to Custom Events. My only marked Custom Event is "Release".

Do you mean that:

  • Using "push" or "all" events, the webhook works
  • Using "custom" and only choose "release", the webhook doesn't work?

@wxiaoguang
Copy link
Contributor

After updating Gitea my Discord notifications no longer work.

What's the previous version?

@Bovive
Copy link
Author

Bovive commented Mar 26, 2025

Edit: On further investigation it appears to be broken when changing the trigger from Push Events to Custom Events. My only marked Custom Event is "Release".

Do you mean that:

* Using "push" or "all" events, the webhook works

* Using "custom" and only choose "release", the webhook doesn't work?

Push works, correct. Custom Release does not. I did not test all events. Previous version was v1.23.5 I believe. I can reproduce this on the demo site.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 26, 2025

Previous version was v1.23.5 I believe.

That's really strange, there is no related change between them: v1.23.5...v1.23.6

Changelog does mention some webhook related changes in other releases: https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md


It's safe to switch the version between 1.23.x, could you try to downgrade to an older version to check which release started breaking?

@wxiaoguang
Copy link
Contributor

And one more thing, IIRC the "test delivery" button doesn't send "release" events.

So maybe you need to manually trigger a "release" event, and try to check the "Header" & "Content" on the "Request" tab to see whether they are right (eg: try to send that content by CURL)

@Bovive
Copy link
Author

Bovive commented Mar 26, 2025

And one more thing, IIRC the "test delivery" button doesn't send "release" events.

That makes more sense as to what is occurring. The test button indeed does not work if it is set to custom->release. There is no message to indicate that it shouldn't work, and ideally it would be functional or disabled.

That being said, I narrowed it down to message content. I believe it may be due to message length as it was over 2,000 characters. The release notes were rather long. If that is indeed the case, I suppose in an ideal situation the message content would be truncated to fit content restrictions prior to being sent.

@wxiaoguang
Copy link
Contributor

Good catch, if so, then it is not a regression but an old bug: the release message exceeds discord's limit, right?

@Bovive
Copy link
Author

Bovive commented Mar 26, 2025

Good catch, if so, then it is not a regression but an old bug: the release message exceeds discord's limit, right?

Yes, I believe so. The documentation breaks down character limits for the embed. While I did not exceed the overall limit, I believe I was over the limit of "Embed descriptions are limited to 2048 characters".

@Bovive
Copy link
Author

Bovive commented Mar 26, 2025

To add a bit more info here, I was able to debug my webhook message a bit using the Embed Visualizer. I copy and pasted the content section from my Gitea webhook failure and then clicked "Enable Webhook Mode" in the Embed Visualizer. This was the output:

Unrecognized property "wait"
"content" should NOT be empty
"embeds[0].description" should NOT be longer than 2048 characters (5882 currently)
"embeds[0].footer.text" should NOT be empty
"embeds[0].fields" should be array

@wxiaoguang wxiaoguang added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented good first issue Likely to be an easy fix labels Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Likely to be an easy fix issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants