[GH-ISSUE #576] Discord integration something went wrong #419

Closed
opened 2026-02-25 23:42:23 +03:00 by kerem · 5 comments
Owner

Originally created by @Johannp02180 on GitHub (Oct 19, 2021).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/576

Hello, when settings up discord, I can access the link login, and select my server and channel. It then redirects back to healthcheck and I get a something went wrong error:
Screen Shot 2021-10-19 at 2 19 46 PM

I'm not sure if this in the logs will help:
[pid: 301|app: 0|req: 22/50] 10.253.0.5 () {36 vars in 971 bytes} [Tue Oct 19 18:19:35 2021] GET /integrations/add_discord/?code=niRz7OE46ONlmtDO4ztVJkvsNf5XLv&state=b6Ha5yiDz2FrAoyUbotyQog2rgyKqDciKEbHPbTebFE&guild_id=661424797208674314 => generated 0 bytes in 118 msecs (HTTP/1.1 302) 10 headers in 610 bytes (1 switches on core 0)

Originally created by @Johannp02180 on GitHub (Oct 19, 2021). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/576 Hello, when settings up discord, I can access the link login, and select my server and channel. It then redirects back to healthcheck and I get a something went wrong error: <img width="1158" alt="Screen Shot 2021-10-19 at 2 19 46 PM" src="https://user-images.githubusercontent.com/11222092/137968273-b51c9d3c-9784-434a-937a-9a6323b2e50b.png"> I'm not sure if this in the logs will help: `[pid: 301|app: 0|req: 22/50] 10.253.0.5 () {36 vars in 971 bytes} [Tue Oct 19 18:19:35 2021] GET /integrations/add_discord/?code=niRz7OE46ONlmtDO4ztVJkvsNf5XLv&state=b6Ha5yiDz2FrAoyUbotyQog2rgyKqDciKEbHPbTebFE&guild_id=661424797208674314 => generated 0 bytes in 118 msecs (HTTP/1.1 302) 10 headers in 610 bytes (1 switches on core 0)`
kerem closed this issue 2026-02-25 23:42:23 +03:00
Author
Owner

@Enissay commented on GitHub (May 30, 2023):

@Johannp02180 I've got the same, how have you fixed it ?

<!-- gh-comment-id:1567637267 --> @Enissay commented on GitHub (May 30, 2023): @Johannp02180 I've got the same, how have you fixed it ?
Author
Owner

@cuu508 commented on GitHub (May 30, 2023):

It produces the "Something went wrong." message during the OAuth2 flow, when exchanging auth token for an access token, if the response from the server does not contain an "access_token" field.

@Enissay are you seeing this error on a self-hosted instance? If so, to better understand the issue, add a debug statement in hc/front/views.py, add_discord_complete function:

    result = curl.post("https://discordapp.com/api/oauth2/token", data)

    doc = result.json()
    print(result.status_code, doc)  # <--- ADD THIS
    if "access_token" in doc:
        channel = Channel(kind="discord", project=project)
        channel.value = result.text
        channel.save()
        channel.assign_all_checks()
        messages.success(request, "The Discord integration has been added!")
    else:
        messages.warning(request, "Something went wrong.")

    return redirect("hc-channels", project.code)
<!-- gh-comment-id:1567785976 --> @cuu508 commented on GitHub (May 30, 2023): It produces the "Something went wrong." message during the OAuth2 flow, when exchanging auth token for an access token, if the response from the server does not contain an "access_token" field. @Enissay are you seeing this error on a self-hosted instance? If so, to better understand the issue, add a debug statement in hc/front/views.py, `add_discord_complete` function: ```python result = curl.post("https://discordapp.com/api/oauth2/token", data) doc = result.json() print(result.status_code, doc) # <--- ADD THIS if "access_token" in doc: channel = Channel(kind="discord", project=project) channel.value = result.text channel.save() channel.assign_all_checks() messages.success(request, "The Discord integration has been added!") else: messages.warning(request, "Something went wrong.") return redirect("hc-channels", project.code) ```
Author
Owner

@Enissay commented on GitHub (May 30, 2023):

are you seeing this error on a self-hosted instance? If so, to better understand the issue, add a debug statement

@cuu508 Yes, a docker instance. Sadly it seems to require a restart which looses the change since it is not persistent :-/
Or, how can I restart the app it inside the running container ?

<!-- gh-comment-id:1568553592 --> @Enissay commented on GitHub (May 30, 2023): > are you seeing this error on a self-hosted instance? If so, to better understand the issue, add a debug statement @cuu508 Yes, a docker instance. Sadly it seems to require a restart which looses the change since it is not persistent :-/ Or, how can I restart the app it inside the running container ?
Author
Owner

@Enissay commented on GitHub (May 31, 2023):

Okay, finally I trigger a restart of uwsgi by killing it kill -HUP 174...

I can see the following:

401 {'error': 'invalid_client'}
<!-- gh-comment-id:1570686601 --> @Enissay commented on GitHub (May 31, 2023): Okay, finally I trigger a restart of uwsgi by killing it `kill -HUP 174`... I can see the following: ``` 401 {'error': 'invalid_client'} ```
Author
Owner

@Enissay commented on GitHub (May 31, 2023):

Finally it was solved.
I had to reset DISCORD_CLIENT_SECRET and get a new one. Which means the old one somehow was wrong >_>
I thought to do it yesterday but then I told myself it was unlikely...
Anyhow, I hope this would help future lost souls...
Thank you @cuu508 for you fast reactivity and putting me on the right path <3

<!-- gh-comment-id:1570887317 --> @Enissay commented on GitHub (May 31, 2023): Finally it was solved. I had to reset `DISCORD_CLIENT_SECRET` and get a new one. Which means the old one somehow was wrong >_> I thought to do it yesterday but then I told myself it was unlikely... Anyhow, I hope this would help future lost souls... Thank you @cuu508 for you fast reactivity and putting me on the right path <3
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#419
No description provided.