Skip to content

Server-scoped Discord webhook does not save message payload #2570

Description

@JamDaBam

Current Behavior

When creating or editing a Discord webhook from a server's Webhooks page, the Discord-specific fields are not persisted.

The following fields can be entered in the UI:

  • Username
  • Avatar URL
  • Message / Content
  • Forum Thread Name
  • Flags
  • Allowed Mentions
  • Embeds

After saving the webhook and opening it again, all of these fields are empty.

Only the following values are persisted:

  • Endpoint
  • Webhook name
  • Selected events
  • Type

The database entry confirms that the Discord webhook is stored with payload = NULL.

Example:

type     = discord
payload  = NULL
events   = ["server:power.start","server:power.stop",...]

When the webhook is triggered, Pelican correctly detects the event, but Discord rejects the request because the message payload is empty:

HTTP request returned status code 400:
{"message": "Cannot send an empty message", "code": 50006}

Pelican then also logs:

SQLSTATE[23000]: Integrity constraint violation:
NOT NULL constraint failed: webhooks.payload

The webhook itself and the event handling appear to work correctly.

As a workaround, manually setting the payload column in SQLite makes the Discord webhook work immediately, for example:

{
  "username": "Valheim-Server",
  "content": "Valheim-Server: {{event}}"
}

After manually inserting this payload, both server:power.start and server:power.stop successfully send messages to Discord.

However, saving the webhook again through the server Webhooks UI removes or loses the payload again.

Expected Behavior

Discord-specific webhook fields entered in the server Webhooks UI should be stored in the webhook configuration's payload.

When reopening the webhook, the previously configured values should be populated in the form again.

For example, entering:

  • Username: Valheim-Server
  • Message: Valheim-Server: {{event}}

should result in a persisted payload similar to:

{
  "username": "Valheim-Server",
  "content": "Valheim-Server: {{event}}"
}

The configured payload should then be sent when one of the selected events is triggered.

Steps to Reproduce

  1. Open a server in Pelican.
  2. Go to Webhooks.
  3. Create a new webhook or edit an existing webhook.
  4. Select Discord as the webhook type.
  5. Enter a valid Discord webhook endpoint.
  6. Enter a webhook name.
  7. Enter values in the Discord-specific fields, for example:
    • Username: Valheim-Server
    • Message: Test message {{event}}
  8. Select an event such as:
    • Power → Start
    • Power → Stop
  9. Save the webhook.
  10. Open the webhook again.

Result:

The Discord-specific fields are empty again.

Checking the SQLite database shows:

SELECT id, name, type, payload
FROM webhook_configurations;

The webhook has:

type = discord
payload = NULL
  1. Trigger Power → Start or Power → Stop.

Pelican triggers the webhook event, but Discord returns:

400 Cannot send an empty message
  1. Manually set a payload in the database:

    UPDATE webhook_configurations
    SET payload = '{"username":"Valheim-Server","content":"Valheim-Server: {{event}}"}'
    WHERE id = 1;

  2. Trigger the server event again.

The Discord webhook now works correctly.

Additional Information

The Admin webhook implementation appears to contain explicit logic for transforming the Discord form fields into payload and restoring them when editing (mutateFormDataBeforeCreate, mutateFormDataBeforeSave, and mutateFormDataBeforeFill).

The server-scoped webhook UI exposes the same Discord fields, but the resulting webhook configuration does not persist the payload.

This may indicate that the corresponding form-data mutation logic is missing for server-scoped webhooks.

Panel Version

1.0.0-beta38

Wings Version

1.0.0-beta29

Games and/or Eggs Affected

Valheim BepINex

Docker Image

ghcr.io/parkervcp/games:valheim

Error Logs

https://logs.pelican.dev/3b8ff6dd

Is there an existing issue for this?

  • I have searched the existing issues before opening this issue.
  • I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
  • I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.

Activity

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

    not confirmedNot yet verified or reproduced by maintainers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions