servertap icon indicating copy to clipboard operation
servertap copied to clipboard

Webhook not working

Open MindSetFPS opened this issue 9 months ago • 1 comments

Webhooks don't seem to be triggered.

I can do requests to the api and connect to websockets, it's just webhooks that don't work for me.

Tried with this config:

paper-1.21.4.jar servertap latest

debug: true
useKeyAuth: true
key: 'change_me'
normalizeMessages: true

# TLS (a.k.a. SSL) options
tls:
  # Set to true to enable TLS
  enabled: false
  # The path to your keystore (relative to ServerTap's plugin dir)
  keystore: keystore.jks
  # The password for the keystore
  keystorePassword: ""
  # Enforce Server Name Indication (SNI) or not
  sni: false

# Use this list to set allowed CORS Origins ("*" by default)
corsOrigins:
  - "*"

# Example webhook configuration
webhooks:
  default:
    listener: "http://localhost:3232" # Also tried with local ip http://192.168.1.50:3232
    events:
      - PlayerJoin
      - PlayerQuit
      - PlayerKick
      - PlayerDeath
      - PlayerChat

# Number of console log lines to send when websocket connections are opened
# Set to 0 to effectively disable this
websocketConsoleBuffer: 1000

# If you do not wish to show the swagger UI you can disable it here
disable-swagger: false

# Use this feature to configure paths that will be blocked. Put in the exact paths shown by swagger.
blocked-paths:
# - /v1/ping
# - /v1/players/{uuid}
# - /v1/server/*

Tried with python fastapi


from models import Player
from typing import Annotated
from fastapi import Depends, FastAPI, HTTPException, Query
from sqlmodel import Session, SQLModel, create_engin

app = FastAPI()


@app.get("/")
async def player_get():
    print("joined")
    return {"ok": True}

@app.post("/")
async def player_joined(item):
    print(item)
    print("player joined")
    return {"ok": True}

fastapi dev main.py --port 3232

and express js

import express from 'express'

const app = express()

app.use(express.json())


app.get("/", (req, res) => {
    console.log("listening")
    res.send({
        ok: true
    })
})

app.post("/", (req, res) => {
    res.send({
        ok: true
    })
})

app.listen(3232, () => console.log("listenting")

And logs from my last try:

`Starting org.bukkit.craftbukkit.Main 2025-04-12T23:43:15.624707742Z ServerMain WARN Advanced terminal features are not available in this environment [17:43:15 INFO]: [bootstrap] Running Java 21 (OpenJDK 64-Bit Server VM 21.0.2+13-Ubuntu-122.04.1; Private Build null) on Linux 6.13.9-200.fc41.x86_64 (amd64) [17:43:15 INFO]: [bootstrap] Loading Paper 1.21.4-225-main@0767902 (2025-04-11T21:49:39Z) for Minecraft 1.21.4 [17:43:15 INFO]: [PluginInitializerManager] Initializing plugins... [17:43:16 INFO]: [PluginInitializerManager] Initialized 1 plugin [17:43:16 INFO]: [PluginInitializerManager] Bukkit plugins (1):

  • ServerTap (0.6.1) [17:43:19 INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, name=PROD] [17:43:20 INFO]: Loaded 1370 recipes [17:43:20 INFO]: Loaded 1481 advancements [17:43:20 INFO]: [MCTypeRegistry] Initialising converters for DataConverter... [17:43:20 INFO]: [MCTypeRegistry] Finished initialising converters for DataConverter in 134.7ms [17:43:20 INFO]: Starting minecraft server version 1.21.4 [17:43:20 INFO]: Loading properties [17:43:20 INFO]: This server is running Paper version 1.21.4-225-main@0767902 (2025-04-11T21:49:39Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT) [17:43:20 INFO]: [spark] This server bundles the spark profiler. For more information please visit https://docs.papermc.io/paper/profiling [17:43:20 INFO]: Server Ping Player Sample Count: 12 [17:43:20 INFO]: Using 4 threads for Netty based IO [17:43:21 INFO]: [MoonriseCommon] Paper is using 3 worker threads, 1 I/O threads [17:43:21 INFO]: [ChunkTaskScheduler] Chunk system is using population gen parallelism: true [17:43:21 INFO]: Default game type: SURVIVAL [17:43:21 INFO]: Generating keypair [17:43:21 INFO]: Starting Minecraft server on *:25565 [17:43:21 INFO]: Using epoll channel type [17:43:21 INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity. [17:43:21 INFO]: Paper: Using OpenSSL 3.x.x (Linux x86_64) cipher from Velocity. [17:43:21 INFO]: [ServerTap] Loading server plugin ServerTap v0.6.1 [17:43:21 INFO]: Server permissions file permissions.yml is empty, ignoring it [17:43:21 INFO]: [ServerTap] Enabling ServerTap v0.6.1 [17:43:21 INFO]: [ServerTap] No Vault plugin detected [17:43:21 WARN]: [ServerTap] TLS is not enabled. [17:43:21 INFO]: [ServerTap] Enabling CORS for * [17:43:21 WARN]: [ServerTap] AUTH KEY IS SET TO DEFAULT "change_me" [17:43:21 WARN]: [ServerTap] CHANGE THE key IN THE config.yml FILE [17:43:21 WARN]: [ServerTap] FAILURE TO CHANGE THE KEY MAY RESULT IN SERVER COMPROMISE [17:43:22 INFO]: [io.javalin.Javalin] Starting Javalin ... [17:43:22 INFO]: [org.eclipse.jetty.server.Server] jetty-11.0.15; built: 2023-04-11T18:37:53.775Z; git: 5bc5e562c8d05c5862505aebe5cf83a61bdbcb96; jvm 21.0.2+13-Ubuntu-122.04.1 [17:43:22 INFO]: [org.eclipse.jetty.server.session.DefaultSessionIdManager] Session workerName=node0 [17:43:22 INFO]: [org.eclipse.jetty.server.handler.ContextHandler] Started i.j.j.@3a94b2ec{/,null,AVAILABLE} [17:43:22 INFO]: [org.eclipse.jetty.server.AbstractConnector] Started ServerConnector@1adace9e{HTTP/1.1, (http/1.1)}{0.0.0.0:4568} [17:43:22 INFO]: [org.eclipse.jetty.server.Server] Started Server@53f43a1b{STARTING}[11.0.15,sto=0] @7806ms [17:43:22 INFO]: [io.javalin.Javalin] Your JDK supports Loom. Javalin will prefer Virtual Threads by default. Disable with ConcurrencyUtil.useLoom = false. [17:43:22 INFO]: [io.javalin.Javalin] Listening on http://localhost:4568/ [17:43:22 INFO]: [io.javalin.Javalin] You are running Javalin 5.6.2 (released July 31, 2023. Your Javalin version is 621 days old. Consider checking for a newer version.). [17:43:22 INFO]: [io.javalin.Javalin] Javalin started in 279ms \o/ [17:43:22 WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE! [17:43:22 WARN]: The server will make no attempt to authenticate usernames. Beware. [17:43:22 WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose. [17:43:22 WARN]: To change this, set "online-mode" to "true" in the server.properties file. [17:43:22 INFO]: Preparing level "world" [17:43:22 INFO]: Preparing start region for dimension minecraft:overworld [17:43:22 INFO]: Preparing spawn area: 0% [17:43:23 INFO]: Preparing spawn area: 36% [17:43:23 INFO]: Time elapsed: 505 ms [17:43:23 INFO]: Preparing start region for dimension minecraft:the_nether [17:43:23 INFO]: Preparing spawn area: 0% [17:43:23 INFO]: Time elapsed: 108 ms [17:43:23 INFO]: Preparing start region for dimension minecraft:the_end [17:43:23 INFO]: Preparing spawn area: 0% [17:43:23 INFO]: Time elapsed: 52 ms [17:43:23 INFO]: [spark] Starting background profiler... [17:43:23 INFO]: Done preparing level "world" (1.178s) [17:43:23 INFO]: Running delayed init tasks [17:43:23 INFO]: Done (8.336s)! For help, type "help" [17:44:18 INFO]: UUID of player player is f3bcb9e4-5db5-3168-a2bc-39d5a29338ef [17:44:18 INFO]: player joined the game [17:44:18 INFO]: player[/172.29.0.1:52154] logged in with entity id 22 at ([world]0.5, 65.0, 5.5) [17:44:54 INFO]: player lost connection: Disconnected [17:44:54 INFO]: player left the game [17:44:56 INFO]: UUID of player pichula is f3bcb9e4-5db5-3168-a2bc-39d5a29338ef [17:44:56 INFO]: player joined the game [17:44:56 INFO]: player[/172.29.0.1:32780] logged in with entity id 699 at ([world]13.830353740946508, 75.0, 31.493281321424632)`

MindSetFPS avatar Apr 12 '25 23:04 MindSetFPS

I used this python code

from fastapi import FastAPI, Request

app = FastAPI()


@app.post("/")
async def read_body(request: Request):
    body = await request.json()
    print(body)
    return {"received": body}

And used pip install fastapi[standard]

And then fastapi dev main.py --port 3232

And then using Paper 1.21.4 I used this config in ServerTap/config.yml:

# Example webhook configuration
webhooks:
  default:
    listener: "http://localhost:3232"
    events:
      - PlayerJoin
      - PlayerQuit

And then I joined, and then quit, and the FastAPI server produced this

{'player': {'uuid': '55f584e4-f095-48e0-bb8a-eb5c87ffe494', 'displayName': 'phybros', 'address': '0:0:0:0:0:0:0:1', 'port': 52724, 'exhaustion': 0.82099915, 'exp': 0.6666666, 'whitelisted': True, 'banned': False, 'op': True}, 'joinMessage': 'phybros joined the game', 'eventType': 'PlayerJoin'}
      INFO   127.0.0.1:52729 - "POST / HTTP/1.1" 200
{'player': {'uuid': '55f584e4-f095-48e0-bb8a-eb5c87ffe494', 'displayName': 'phybros', 'address': '0:0:0:0:0:0:0:1', 'port': 52724, 'exhaustion': 0.82099915, 'exp': 0.6666666, 'whitelisted': True, 'banned': False, 'op': True}, 'quitMessage': 'phybros left the game', 'eventType': 'PlayerQuit'}
      INFO   127.0.0.1:52732 - "POST / HTTP/1.1" 200

Which would seem to suggest there might be something wrong with your Pydantic schema or something like that. Maybe try examine the incoming request.

phybros avatar May 27 '25 18:05 phybros