pushrax / node-rcon

A generic RCON protocol client for node.js
MIT License
134 stars 31 forks source link

No error, no response, no connection #50

Closed shaunclark5649 closed 1 year ago

shaunclark5649 commented 1 year ago

Maybe this is something I am doing wrong, I have a nextJS app setup that utilises the next API

I make a request to my endpoint with the following code.

` import Rcon from "rcon-srcds";

    const server = new Rcon({
      host: process.env.RCON_IP,
      port: process.env.RCON_PORT,
    });

    export default async function handler(req, res) {
      try {
        await server.authenticate(process.env.RCON_PASSWORD);

        await server.connect().then(() => {
          console.log("Connected");
        });

        await server.execute("status").then((response) => {
          console.log(response);
          res
            .status(200)
            .json({
              message: "RCON command executed successfully.",
              reponse: response,
            });
        });

        } catch (error) {
          console.error(error);
          res.status(500).json({ message: "Error executing RCON command." });
        }
      }

`

I do not get any error catch, I do not get any logs, all my credentials are correct.

I am not sure if this is my code or the lib, I am at a complete loss.