Skip to content

Certificate problem #276

Description

@lynn2910

Hello, i'm trying to setup a websocket using mlua and tungstenite for a lua package, but i get this error when connecting:

[2023-05-21T15:15:23Z DEBUG tungstenite::client] Trying to contact wss://gateway.discord.gg/?v=10&encoding=json at 162.159.136.234:443...
thread '<unnamed>' panicked at 'Can't connect: Tls(Native(Ssl(Error { code: ErrorCode(1), cause: Some(Ssl(ErrorStack([]))) }, X509VerifyResult { code: 20, error: "unable to get local issuer certificate" })))', src/workers/ws.rs:75:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[string "bundle:/init.lua"]:70: attempt to concatenate local 'err' (a userdata value)
stack traceback:
	[string "bundle:/init.lua"]:70: in function 'fn'
	[string "bundle:deps/require.lua"]:310: in function <[string "bundle:deps/require.lua"]:266>

But, the weird thing is that, when i run the code on my computer, without executing in lua, it works perfectly.

Does someone know how to get rid of this certificate problem ?

Activity

  1. khvzak commented on May 21, 2023

    @khvzak
    Member

    Do you have code to reproduce?

  2. lynn2910 commented on May 21, 2023

    @lynn2910
    Author

    I uploaded the code to a repositery:

    https://github.com/Sedorikku1949/discolua

    As this will be a package to manage a discord bot, a token is required to be put in the test directory (explained in test/README.md)

  3. khvzak commented on May 21, 2023

    @khvzak
    Member

    this is what I got when running it:

    [2023-05-21T21:10:34Z TRACE discolua::workers::ws] Connecting to the server...
    [2023-05-21T21:10:34Z DEBUG tungstenite::client] Trying to contact wss://gateway.discord.gg/?v=10&encoding=json at 162.159.136.234:443...
    [2023-05-21T21:10:34Z TRACE tungstenite::handshake::client] Request: "GET /?v=10&encoding=json HTTP/1.1\r\nHost: gateway.discord.gg\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: bMbzv7d9hCnqCNY6TQ2f5w==\r\n\r\n"
    [2023-05-21T21:10:34Z TRACE tungstenite::handshake::client] Client handshake initiated.
    [2023-05-21T21:10:34Z TRACE tungstenite::handshake::machine] Doing handshake round.
    [2023-05-21T21:10:34Z TRACE tungstenite::handshake::machine] Doing handshake round.
    [2023-05-21T21:10:34Z DEBUG tungstenite::handshake::client] Client handshake done.
    [2023-05-21T21:10:34Z TRACE discolua::workers::ws] Connected to the server
    [2023-05-21T21:10:34Z TRACE tungstenite::protocol] Frames still in queue: 0
    [2023-05-21T21:10:34Z TRACE tungstenite::protocol::frame::frame] Parsed headers [129, 124]
    [2023-05-21T21:10:34Z TRACE tungstenite::protocol::frame::frame] First: 10000001
    [2023-05-21T21:10:34Z TRACE tungstenite::protocol::frame::frame] Second: 1111100
    [2023-05-21T21:10:34Z TRACE tungstenite::protocol::frame::frame] Opcode: Data(Text)
    [2023-05-21T21:10:34Z TRACE tungstenite::protocol::frame::frame] Masked: false
    [2023-05-21T21:10:34Z TRACE tungstenite::protocol::frame] received frame
    

    seems all works?

  4. locked and limited conversation to collaborators on May 23, 2023
  5. converted this issue into a discussion #278 on May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions