matrix-org / matrix-js-sdk

Matrix Client-Server SDK for JavaScript
Apache License 2.0
1.61k stars 589 forks source link

M_MISSING_ARGUMENT: A known registration type (e.g. m.login.application_service) must be specified if an access_token is provided #1676

Closed bodqhrohro closed 3 years ago

bodqhrohro commented 3 years ago

Describe the bug I have this error when running the up-to-date Bifröst and Dendrite:

Apr-25 01:22:34.183 WARN bridge [-] POST http://localhost:8008/_matrix/client/r0/register (AS) HTTP 400 Error: "{\"errcode\":\"M_MISSING_ARGUMENT\",\"error\":\"A known registration type (e.g. m.login.application_service) must be specified if an access_token is provided\"}"
Apr-25 01:22:34.530 ERROR Program Failed to start: M_MISSING_ARGUMENT: A known registration type (e.g. m.login.application_service) must be specified if an access_token is provided
    at parseErrorResponse (/media/d/temp/git/matrix-bifrost/node_modules/matrix-js-sdk/lib/http-api.js:826:13)
    at /media/d/temp/git/matrix-bifrost/node_modules/matrix-js-sdk/lib/http-api.js:781:17
    at /media/d/temp/git/matrix-bifrost/node_modules/matrix-js-sdk/lib/http-api.js:715:9
    at Request._callback (/media/d/temp/git/matrix-bifrost/node_modules/matrix-appservice-bridge/src/components/client-factory.ts:119:17)
    at Request.self.callback (/media/d/temp/git/matrix-bifrost/node_modules/request/request.js:185:22)
    at Request.emit (events.js:314:20)
    at Request.<anonymous> (/media/d/temp/git/matrix-bifrost/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:314:20)
    at IncomingMessage.<anonymous> (/media/d/temp/git/matrix-bifrost/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:420:28) {
  errcode: 'M_MISSING_ARGUMENT',
  data: {
    errcode: 'M_MISSING_ARGUMENT',
    error: 'A known registration type (e.g. m.login.application_service) must be specified if an access_token is provided'
  },
  httpStatus: 400
}

I traced it down to this dependency, as this is where the actual register request is made, and where the registration type doesn't seem to be set at all.

To Reproduce Here's my bifrost-registration.yaml, possibly outdated:

id: c587da5ea4c7c6aae572558a8ee79b4b3c84b4bc4d500ce6ff89ca2be4551b90
hs_token: 13fa86db333022f58a49152ce49ab17479e3becf3c4aab3661b0c75f828ed2de
as_token: 98d7f7cb023ad6002c0bdc13612cee7fb19bd2ea7f48947da0febc82d7cd8c63
namespaces:
  users:
    - exclusive: false
      regex: '@bifrost_.*'
  aliases:
    - exclusive: true
      regex: '#_bifrost_.*'
  rooms:
    - exclusive: true
      regex: '#.*'
url: 'http://localhost:9555'
sender_localpart: bifrost_bot
rate_limited: true
protocols: null

Expected behavior The bot registration is done in a spec-compliant way.

Desktop (please complete the following information):

turt2live commented 3 years ago

Bifrost needs to update its matrix-appservice-bridge dependency to a newer version (2.5.0 or higher).