discord-net / Discord.Net

An unofficial .Net wrapper for the Discord API (https://discord.com/)
https://discordnet.dev
MIT License
3.32k stars 738 forks source link

[Bug]: Unable to connect using a docker container #2703

Open rster2002 opened 1 year ago

rster2002 commented 1 year ago

Check The Docs

Verify Issue Source

Check your intents

Description

I have been trying to deploy a discord bot using docker and I'm having an issue getting the bot to connect.

Below is the output of running docker version:

Client: Docker Engine - Community
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:52:53 2023
 OS/Arch:           linux/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:52:53 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Version

3.10.0

Working Version

No response

Logs

[06/19/2023 16:09:02] (Discord) (Discord.Net v3.10.0 (API v10)) Application started (^人^) [06/19/2023 16:09:02] (Gateway) (Connecting) [06/19/2023 16:09:02] (Gateway) (Connecting ApiClient) [06/19/2023 16:09:02] (Gateway) () [06/19/2023 16:09:02] (Gateway) (Disconnecting) [06/19/2023 16:09:02] (Gateway) (Disconnecting ApiClient) [06/19/2023 16:09:02] (Gateway) (Waiting for heartbeater) [06/19/2023 16:09:02] (Gateway) (Waiting for guild downloader) [06/19/2023 16:09:02] (Gateway) (Clearing large guild queue) [06/19/2023 16:09:02] (Gateway) (Raising virtual GuildUnavailables) [06/19/2023 16:09:02] (Gateway) (Disconnected) [06/19/2023 16:09:03] (Gateway) (Connecting) [06/19/2023 16:09:03] (Gateway) (Connecting ApiClient) [06/19/2023 16:09:03] (Gateway) () [06/19/2023 16:09:03] (Gateway) (Disconnecting) [06/19/2023 16:09:03] (Gateway) (Disconnecting ApiClient) [06/19/2023 16:09:03] (Gateway) (Waiting for heartbeater) [06/19/2023 16:09:03] (Gateway) (Waiting for guild downloader) [06/19/2023 16:09:03] (Gateway) (Clearing large guild queue) [06/19/2023 16:09:03] (Gateway) (Raising virtual GuildUnavailables) [06/19/2023 16:09:03] (Gateway) (Disconnected)

Sample

No response

Packages

Discord.Net, Discord.Net.Analyzers, Discord.Net.Commands, Discord.Net.Core, Discord.Net.Extensions, Discord.Net.Interactions, Discord.Net.Rest, Discord.Net.Webhook, Discord.Net.WebSocket, Microsoft.Extensions.DependencyInjection, Microsoft.Extensions.Logging, Victoria

Misha-133 commented 1 year ago

This looks like the client can't connect to Discord API It can be a result of:

rster2002 commented 1 year ago

I am able to exec into the container and run updates and download things using curl, so I do think is has an internet connection. I can double check to see if websockets work maybe they're being blocked? I'll get back to you on that one.

Misha-133 commented 11 months ago

@rster2002 Any updates on this? Can you still reproduce the issue on DNet v3.13.0?

rster2002 commented 11 months ago

I'm so sorry, I thought I had already posted my findings 😓 So I checked if maybe websockets where the thing that were going wrong in Docker but managed to rule that out by using a small NodeJS application to test. I'll see if I can reproduce this issue in the newest release.

I know that before I was able to run it directly on windows (10), but wasn't able to run it in Docker (on windows 10)

rster2002 commented 11 months ago

Just checked on the server I was initially running it on:

Starting container still shows errors and does not work. If I the copy the files out of the container (using docker compose cp) and then run the appliation it does connect.