mjolnir icon indicating copy to clipboard operation
mjolnir copied to clipboard

Since 4376679b997bc92d613974d4daa2091e696c8ee5 install instructions require setting the NODE_ENV or editing default.yaml

Open deepbluev7 opened this issue 3 years ago • 7 comments

Describe the bug Since #347 mjolnir doesn't start anymore. I fixed that by explicitly setting the node env to development:

neko:lib/synapse/mjolnir remotes/origin/gnuxie/audit-yarn-lock~1 (bisect) # node lib/index.js
Tue, 30 Aug 2022 16:41:06 GMT [INFO] [index] Starting bot...
Tue, 30 Aug 2022 16:41:06 GMT [ERROR] [MatrixHttpClient (REQ-1)] [Error: Error during MatrixClient request GET /_matrix/client/r0/joined_rooms: 401 Unauthorized -- {"errcode":"M_UNKNOWN_TOKEN","error":"Invalid access token passed.","soft_logout":false}]
Failed to setup mjolnir from the config /data/storage: Error: Error during MatrixClient request GET /_matrix/client/r0/joined_rooms: 401 Unauthorized -- {"errcode":"M_UNKNOWN_TOKEN","error":"Invalid access token passed.","soft_logout":false}
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: Error during MatrixClient request GET /_matrix/client/r0/joined_rooms: 401 Unauthorized -- {"errcode":"M_UNKNOWN_TOKEN","error":"Invalid access token passed.","soft_logout":false}]

Node.js v18.6.0                                                                                                                                                                                                                                                               neko:lib/synapse/mjolnir remotes/origin/gnuxie/audit-yarn-lock~1 (bisect) # git bisect bad
4376679b997bc92d613974d4daa2091e696c8ee5 is the first bad commit
commit 4376679b997bc92d613974d4daa2091e696c8ee5                                                                                                                                                                                                                               Author: Jess Porter <[email protected]>
Date:   Tue Aug 16 15:51:18 2022 +0100

    load config yaml manually, remove more references to static config (#347)

To Reproduce Steps to reproduce the behavior:

  1. Follow install instructions that tell you do edit development.yaml
  2. Try to start mjolnir
  3. Startup fails

Expected behavior Mjolnir starts

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Gentoo
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

deepbluev7 avatar Aug 30 '22 16:08 deepbluev7

For context: these are the instructions being referred to

Gnuxie avatar Sep 05 '22 08:09 Gnuxie

Investigating. @deepbluev7, are you using pantalaimon? Just to be certain, did you specify ACCESS_TOKEN in your config file?

I don't think it's the cause of your issue, but might as well get rid of the simple hypothesis first :)

Yoric avatar Sep 06 '22 07:09 Yoric

@Gnuxie @jesopo So, to confirm:

We should fix one of these :)

Which one is the expected behavior?

Yoric avatar Sep 06 '22 08:09 Yoric

Investigating. @deepbluev7, are you using pantalaimon? Just to be certain, did you specify ACCESS_TOKEN in your config file?

I am not using that and the issue is simply that the mentioned commit uses a different config file by default without setting environment variables then it did before. The fix is to either rename development.yaml to default.yaml or set NODE_ENV=development :3

deepbluev7 avatar Sep 06 '22 08:09 deepbluev7

Which one is the expected behavior?

Well, arguably the old behaviour was to use development.yaml, so I would suggest to keep that, but in the end it doesn't really matter, as long as there is correct documentation and if something changes, instructions how to migrate.

deepbluev7 avatar Sep 06 '22 08:09 deepbluev7

@Gnuxie @jesopo So, to confirm:

* [the instructions](https://github.com/matrix-org/mjolnir/blob/main/docs/setup_selfbuild.md) claim that the user should edit `development.yaml`;

* [the code](https://github.com/matrix-org/mjolnir/pull/347/files#diff-c3095d5010e65c52737a98a5d618ea24049ebe90c8470752426081d70ed6e012) will load `default.yaml`.

We should fix one of these :)

Which one is the expected behavior?

@Yoric I think we should be telling users to use default.yaml if they're not running mjolnir for development purposes

jesopo avatar Sep 06 '22 09:09 jesopo

Looks to me like the documentation has been wrong since at least https://github.com/matrix-org/mjolnir/commit/bf7f1318af3ef057b67152e64cd553eb81494f93 . I'll fix that.

Yoric avatar Sep 07 '22 08:09 Yoric