msgbyte / msgbyte/tianji

Unable to send webhook and telegram notifications

Open
#165 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.1k
Forks
194
Avg merge
18m
Merged PRs (30d)
3

Description

Test messages can be sent to webhook and telegram, but when notifications are enabled in the monitor, messages cannot be sent.
This is the webhook error log:

Error: notification.test AxiosError: Request failed with status code 404
    at settle (file:///app/tianji/node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/core/settle.js:19:12)
    ... 13 lines matching cause stack trace ...
    at async callRecursive (file:///app/tianji/node_modules/.pnpm/@trpc+server@11.0.0-rc.648_typescript@5.7.2/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:143:24) {
  cause: AxiosError: Request failed with status code 404
      at settle (file:///app/tianji/node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/core/settle.js:19:12)
      at IncomingMessage.handleStreamEnd (file:///app/tianji/node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/adapters/http.js:599:11)
      at IncomingMessage.emit (node:events:530:35)
      at endReadableNT (node:internal/streams/readable:1698:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
      at Axios.request (file:///app/tianji/node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/core/Axios.js:45:41)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.send (file:///app/tianji/src/server/dist/src/server/model/notification/provider/webhook.js:10:9)
      at async sendNotification (file:///app/tianji/src/server/dist/src/server/model/notification/index.js:7:5)
      at async file:///app/tianji/src/server/dist/src/server/trpc/routers/notification.js:23:9
      at async resolveMiddleware (file:///app/tianji/node_modules/.pnpm/@trpc+server@11.0.0-rc.648_typescript@5.7.2/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:102:30)
      at async callRecursive (file:///app/tianji/node_modules/.pnpm/@trpc+server@11.0.0-rc.648_typescript@5.7.2/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:143:24)
      at async callRecursive (file:///app/tianji/node_modules/.pnpm/@trpc+server@11.0.0-rc.648_typescript@5.7.2/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:143:24)
      at async callRecursive (file:///app/tianji/node_modules/.pnpm/@trpc+server@11.0.0-rc.648_typescript@5.7.2/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:143:24)
      at async callRecursive (file:///app/tianji/node_modules/.pnpm/@trpc+server@11.0.0-rc.648_typescript@5.7.2/node_modules/@trpc/server/dist/unstable-core-do-not-import/procedureBuilder.mjs:143:24) {
    code: 'ERR_BAD_REQUEST',
    config: {
      transitional: [Object],
      adapter: [Array],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: [Object],
      validateStatus: [Function: validateStatus],
      headers: [Object [AxiosHeaders]],
      method: 'post',
      url: 'https://notice.domain.com:8888/notice/tools/plugin/tianji/notice ';,
      data: '{"notification":{"workspaceId":"clnzoxcy10001vy2ohi4obbi0","name":"nzu-tianji","type":"webhook","payload":{"webhookUrl":"https://notice.domain.com:8888/notice/tools/plugin/tianji/notice ";}},"title":"nzu-tianji Notification Testing","content":"Tianji: Insight into everything\\nThis is Notification Testing from nzu-tianji\\n[image]","raw":[{"type":"title","level":2,"content":"Tianji: Insight into everything"},{"type":"text","content":"This is Notification Testing from nzu-tianji"},{"type":"newline"},{"type":"image","url":"https://tianji.msgbyte.com/img/social-card.png ";}],"time":"2025-02-23T08:10:51.021Z"}'
    },
    request: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: false,
      chunkedEncoding: false,
      shouldKeepAlive: true,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: '619',
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      socket: [TLSSocket],
      _header: 'POST /notice/tools/plugin/tianji/notice HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' +
        'User-Agent: tianji/1.18.5\r\n' +
        'Content-Length: 619\r\n' +
        'Accept-Encoding: gzip, compress, deflate, br\r\n' +
        'Host: notice.domain.com:8888\r\n' +
        'Connection: keep-alive\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/notice/tools/plugin/tianji/notice',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'notice.domain.com',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    response: {
      status: 404,
      statusText: 'Not Found',
      headers: [Object [AxiosHeaders]],
      config: [Object],
      request: [ClientRequest],
      data: '404: Not Found'
    },
    status: 404
  },
  code: 'INTERNAL_SERVER_ERROR',
  name: 'TRPCError'
}
POST /trpc/notification.test?batch=1 500 - - 57.822 ms

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the notification paths shown in the trace: server/model/notification/provider/webhook.js, server/model/notification/index.js, and server/trpc/routers/notification.js, then compare the test-message flow with notifications triggered by a monitor. Reproduce the 404 and verify that enabled monitor notifications reach both webhook and Telegram destinations successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.