waha icon indicating copy to clipboard operation
waha copied to clipboard

[GOWS] - Production: 500 Internal Server Error on session creation due to PostgreSQL collation version mismatch

Open TheOneironaut opened this issue 1 year ago • 2 comments

An attempt to create a new session for the bot (name: "bot4") failed with a 500 Internal Server Error. The error is caused by a Collation version mismatch in the underlying PostgreSQL database when attempting to create a new database from the template (template1).

Steps to Reproduce Send a POST request to the /api/sessions/ endpoint.

The request body (Payload) is:

{
  "name": "bot4",
  "config": {
    "metadata": {},
    "webhooks": []
  },
  "start": true
}

Error Response

  "statusCode": 500,
  "timestamp": "2025-10-05T07:42:22.286Z",
  "exception": {
    "message": "CREATE DATABASE \"waha_gows_bot4\" - template database \"template1\" has a collation version mismatch",
    "length": 422,
    "name": "error",
    "severity": "ERROR",
    "code": "XX000",
    "detail": "The template database was created using collation version 2.36, but the operating system provides version 2.41.",
    "hint": "Rebuild all objects in the template database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.",
    "file": "dbcommands.c",
    "line": "1247",
    "routine": "createdb",
    "stack": "error: CREATE DATABASE \"waha_gows_bot4\" - template database \"template1\" has a collation version mismatch\n at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:285:98)\n at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:122:29)\n at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:35:38)\n at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)\n at Socket.emit (node:events:518:28)\n at addChunk (node:internal/streams/readable:561:12)\n at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)\n at Readable.push (node:internal/streams/readable:392:5)\n at TCP.onStreamRead (node:internal/stream_base_commons:189:23)\n at TCP.callbackTrampoline (node:internal/async_hooks:130:17)"
  },
  "request": {
    "path": "/api/sessions/",
    "method": "POST",
    "body": {
      "name": "bot4",
      "config": {
        "metadata": {},
        "webhooks": []
      },
      "query": {}
    }
  },
  "version": {
    "version": "2025.9.8",
    "engine": "GOWS",
    "tier": "PLUS",
    "browser": null
  }
}

patron:PLUS

TheOneironaut avatar Oct 05 '25 07:10 TheOneironaut

@raivat14 Is this still a problem? I can't reproduce this on my machine (classic).

Version: 6.2.1-nightly.41 Server: Ferdium Server Electron: 21.2.2 Chrome: 106.0.5249.168 Node.js: 16.16.0 Platform: macOS Arch: arm64 Build date: Mon Nov 07 2022 02:41:44 GMT+0100 (Central European Standard Time) Git SHA: 4c357d77 Git branch: nightly

If this is working for you feel free to close this issue.

cino avatar Nov 10 '22 21:11 cino

I ran this on the database: ALTER DATABASE template1 refresh collection version; and on the other databases too and now it works

patron:PLUS

TheOneironaut avatar Oct 05 '25 08:10 TheOneironaut

https://github.com/devlikeapro/waha/issues/1380

patron:PRO

devlikepro avatar Oct 06 '25 09:10 devlikepro