Coder Social home page Coder Social logo

Comments (12)

Anillc avatar Anillc commented on September 26, 2024

麻烦贴一下配置文件,包括 matrix 侧的 registry.yaml 和 koishi 的配置文件

from koishi-plugin-adapter-matrix.

yunkuangao avatar yunkuangao commented on September 26, 2024

好的

koishi plugin:
image

registray.yaml:
image

from koishi-plugin-adapter-matrix.

yunkuangao avatar yunkuangao commented on September 26, 2024

之前我koishi的id用的application service id,报的是403,后面我换成sender_localpart,报的就是500了

错误如下:
matrix failed to initialize AxiosError: Request failed with status code 500 at settle (/koishi/node_modules/cordis-axios/node_modules/axios/dist/node/axios.cjs:1268:12) at IncomingMessage.handleStreamEnd (/koishi/node_modules/cordis-axios/node_modules/axios/dist/node/axios.cjs:2446:11) at IncomingMessage.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ERR_BAD_RESPONSE', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [Function: httpAdapter], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 5000, xsrfCookieName...

from koishi-plugin-adapter-matrix.

Anillc avatar Anillc commented on September 26, 2024

403 我怀疑是你的两个 token 配置有问题,我晚上有空的话再测一下,理论上这个适配器应该没有坏

from koishi-plugin-adapter-matrix.

yunkuangao avatar yunkuangao commented on September 26, 2024

抱歉没有说清楚,403是我用application service id当作koishi里面的id的时候报的
后面我用sender_localpart当作koishi的id的时候就是500
如果我没猜错的话,koishi里面的id应该是对应synapse里面的sender_localpart对吧?

from koishi-plugin-adapter-matrix.

Anillc avatar Anillc commented on September 26, 2024

如果我没猜错的话,koishi里面的id应该是对应synapse里面的sender_localpart对吧?

并不是,sender_localpart 与 matrix adapter 的 id 不应该相等,因为 matrix 会给 application service 分配一个账号,但是 matrix 会为机器人创建账号,如果 id 重复了就会报错。

这样做的目的是为了让同一个 application service 可以有多个 bot 账号。

403是我用application service id当作koishi里面的id的时候报的

application service id 跟 sender_localpart 和 matrix adapter 中的 id 应该是没有关系的才对。403 报错一般是鉴权的问题,所以我前面怀疑你的 token 配置有问题。

from koishi-plugin-adapter-matrix.

yunkuangao avatar yunkuangao commented on September 26, 2024

OK,现在能登录上了,但是有新的问题。

在koishi的console界面还是处于连接状态,但是在element这边就已经是离线状态了,而且对于邀请进入房间也都没有任何反应,verifier已经安装且配置为全部通过:
image

element界面:
image

from koishi-plugin-adapter-matrix.

Anillc avatar Anillc commented on September 26, 2024

日志里有没有报错呢

from koishi-plugin-adapter-matrix.

yunkuangao avatar yunkuangao commented on September 26, 2024

日志里面没有报错,这就是最诡异的一点了。
Snipaste_2023-03-30_09-23-54

from koishi-plugin-adapter-matrix.

Anillc avatar Anillc commented on September 26, 2024

测试了一下,matrix adapter 是有在正常工作的。你到 synapse 那里看下日志(可以用 grep 过滤一下你的 application service id),看看是不是 synapse 到你的机器人的请求失败了。

另外 synapse 不支持 301 这类跳转,如果到你机器人的 http 接口 (PUT /transactions/123) 会返回 301 的话将会失败,请注意一下

from koishi-plugin-adapter-matrix.

yunkuangao avatar yunkuangao commented on September 26, 2024

抱歉,周末两天有点事情。
我看了下synapse日志,发现有个错误

synapse | 2023-04-03 09:52:32,184 - synapse.http.server - 107 - INFO - POST-122 - <XForwardedForRequest at 0x7f61b41bff10 method='POST' uri='/_matrix/client/v3/register' clientproto='HTTP/1.1' site='8008'> SynapseError: 400 - Invalid user localpart for this application service.
synapse | 2023-04-03 09:52:32,185 - synapse.access.http.8008 - 460 - INFO - POST-122 - 172.71.147.166 - 8008 - {None} Processed request: 0.002sec/0.000sec (0.002sec, 0.000sec) (0.000sec/0.000sec/0) 88B 400 "POST /_matrix/client/v3/register HTTP/1.1" "axios/1.1.3" [0 dbevts]
synapse | 2023-04-03 09:52:32,222 - synapse.rest.client.login - 256 - INFO - POST-123 - Got appservice login request with identifier: {'type': 'm.id.user', 'user': 'bot111'}
synapse | 2023-04-03 09:52:32,222 - synapse.http.server - 107 - INFO - POST-123 - <XForwardedForRequest at 0x7f61b41bf450 method='POST' uri='/_matrix/client/v3/login' clientproto='HTTP/1.1' site='8008'> SynapseError: 403 - Invalid access_token
synapse | 2023-04-03 09:52:32,225 - synapse.access.http.8008 - 460 - INFO - POST-123 - 172.71.151.42 - 8008 - {@hello:im.yka.moe} Processed request: 0.001sec/0.002sec (0.001sec, 0.000sec) (0.000sec/0.000sec/0) 56B 403 "POST /_matrix/client/v3/login HTTP/1.1" "axios/1.1.3" [0 dbevts]

但是这个sender_localpart要怎么改才正确呢,我试过和application service id 一样以及不一样,都会有这个错误
另外关于网络问题,我没有301跳转,但是有一层代理,用的cloudflare cdn和traefik,docker compose配置如下:

version: '3'
services:
  synapse:
    image: docker.io/matrixdotorg/synapse
    container_name: synapse
    restart: always
    environment:
      - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
      - TZ=Asia/Shanghai
    volumes:
      - $PWD/files:/data
    labels:
      - traefik.http.routers.synapse.rule=Host(`im.yka.moe`)
      - traefik.http.routers.synapse.entrypoints=https
      - traefik.http.routers.synapse.tls.certresolver=letsencrypt
      - traefik.http.services.synapse.loadbalancer.server.port=8008
    networks:
      - traefik
networks:
  traefik:
    external: true

from koishi-plugin-adapter-matrix.

yunkuangao avatar yunkuangao commented on September 26, 2024

我修改了一下配置之后好像可以了,我也不知道为啥。感谢作者的帮助。

留个配置以供后来人参考:
registry.yaml

id: "koishi"
hs_token: "hs_token"
as_token: "as_token"
url: "https://example.org"
sender_localpart: "koishibot"
namespaces:
  users:
    - exclusive: true
      regex: "@bot:example.org"
  rooms: []

from koishi-plugin-adapter-matrix.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.