jersey/lightning
5
40
Fork
You've already forked lightning
11

matrix avatar and edit bugs #213

Closed
opened 2026年06月25日 21:14:59 +02:00 by ridge · 25 comments

Hi there!

I managed to get Lightning running on my system, and registered it as an appservice on a friend's Matrix homeserver. We have successfully bridged their Matrix room to a Fluxer community.

However, when I send messages from Fluxer, the bot keeps updating my profile picture on the Matrix side.

bilde

As you can see in the picture, the avatar is updated when I send a message.
Not always, but very often.

I'm not sure if I've misconfigured something, but if you could take a look at my configurations and let me know if I did, I would appreciate it.

  • The Matrix homeserver where the appservice is registered is mx.scalie.zone
  • The bot is hosted on my server, lightning-mx.68degrees.no
  • I only have one profile picture (no community specific ones) on Fluxer.
  • I am not using Docker.
  • Debian 13, Go 1.24, Lightning installed 2026年06月24日

Click each to expand them:

lightning.toml
database = "(redacted)"
prefix = "br!"
(Two other Discord plugins stripped from here)
[[plugins]]
type = "discord"
name = "fluxer-scaliebridge"
config.token = "(redacted)"
config.api_host = "api.fluxer.app"
config.cdn_host = "fluxerusercontent.com"
config.frontend = "web.fluxer.app"
[[plugins]]
type = "matrix"
name = "matrix-scaliebridge"
config.homeserver = "mx.scalie.zone"
config.proxy_url = "https://lightning-mx.68degrees.no/matrix"
config.proxy_port = "40995"
config.as_url = "https://lightning-mx.68degrees.no"
config.as_local = "scaliebridge"
config.as_token = "(redacted)"
config.hs_token = "(redacted)"
Appservice registration YAML
id:"ScalieZone Lightning Bridge"url:https://lightning-mx.68degrees.noas_token:(redacted)hs_token:(redacted)sender_localpart:scaliebridgenamespaces:users:- exclusive:trueregex:"@_lightning_.*"rate_limited:false
nginx
server {
 listen 443 ssl;
 http2 on;
 server_name lightning-mx.68degrees.no;
 ssl_certificate (redacted);
 ssl_certificate_key (redacted);
 # Max file upload size
 client_max_body_size 512M;
 # Forward requests to Lightning
 location /matrix/ {
 proxy_pass http://127.0.0.1:40995$request_uri;
 proxy_set_header Host $host;
 proxy_set_header X-Forwarded-For $remote_addr;
 proxy_set_header X-Forwarded-Proto $scheme;
 proxy_read_timeout 300s;
 proxy_send_timeout 300s;
 }
 location / {
 proxy_pass http://127.0.0.1:5000$request_uri;
 proxy_set_header Host $host;
 proxy_set_header X-Forwarded-For $remote_addr;
 proxy_set_header X-Forwarded-Proto $scheme;
 }
}

Also, in case it helps, there is an error related to my Fluxer avatar in the log:

Lightning log
18:32:28 main.go:33: bridge: bot started
18:32:28 client.go:101: matrix: appservice ready at https://matrix.to/#/@scaliebridge:mx.scalie.zone
18:32:28 proxy.go:51: matrix: file proxy listening at :40995 and https://lightning-mx.68degrees.no/matrix
18:32:30 plugin.go:64: discord: ready as Hambot in 1 servers!
18:32:30 plugin.go:65: discord: invite at (redacted)
18:32:30 plugin.go:64: discord: ready as Hambot in 0 servers!
18:32:30 plugin.go:65: discord: invite at (redacted)
18:32:30 plugin.go:64: discord: ready as ScalieBridge in 0 servers!
18:32:30 plugin.go:65: discord: invite at (redacted)
18:33:29 gateway.go:371: discord: socket error, reconnecting: websocket: close 1000 (normal)
18:33:31 gateway.go:287: discord: connection resumed
19:43:46 bridge.go:204: bridge: EditMessage failed in fluxer-scaliebridge::1516619413405569027: Discord API Error: PATCH /v1/webhooks/1519756256598818816/3Ye2sbN7hiKsun1UjQfjHFjgB3zHjz1m6buulPMJZDUnHJd0FphSOC9A6r4JFBCB/messages/1519759980276752384 status 403 code 403;
19:51:18 outgoing.go:115: matrix: upload failed for https://fluxerusercontent.com/avatars/1473736904463351890/31796b3d.png: M_UNKNOWN (HTTP 500): Internal server error
19:51:18 bridge.go:42: bridge: panic on create in "matrix-scaliebridge::!khoUeIx6hgRnrAQC-vfqVNo72hYKLszdEmq66RjhJXE": runtime error: invalid memory address or nil pointer dereference goroutine 1355 [running]:
runtime/debug.Stack()
 /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/runtime/debug/stack.go:26 +0x64
main.main.bridgeCreate.func3.1.1()
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/cmd/lightning/bridge.go:42 +0x3c
panic({0x5f7580?, 0xcfa150?})
 /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/runtime/panic.go:860 +0x12c
codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).getClient(0x7f574a0540, 0x7f5748a370)
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/pkg/platforms/matrix/client.go:122 +0xf8
codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).SendMessage(0x7f574a0540, 0x7f5748a370, 0x7f57708340)
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/pkg/platforms/matrix/plugin.go:78 +0x58
codeberg.org/jersey/lightning/pkg/lightning.(*Bot).SendMessage(0x0?, 0x7f577c5e68, 0x7f57708340)
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/pkg/lightning/methods.go:50 +0xd8
main.main.bridgeCreate.func3.1()
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/cmd/lightning/bridge.go:49 +0x124
sync.(*WaitGroup).Go.func1()
 /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/sync/waitgroup.go:258 +0x48
created by sync.(*WaitGroup).Go in goroutine 1354
 /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/sync/waitgroup.go:238 +0x70
20:15:57 gateway.go:287: discord: connection resumed

Thank you very much in advance.

Hi there! I managed to get Lightning running on my system, and registered it as an appservice on a friend's Matrix homeserver. We have successfully bridged their Matrix room to a Fluxer community. However, when I send messages from Fluxer, the bot keeps updating my profile picture on the Matrix side. ![bilde](/attachments/6b4a8721-7a3d-4a54-9bb1-0c15b0cf51bc) As you can see in the picture, the avatar is updated when I send a message. Not always, but very often. I'm not sure if I've misconfigured something, but if you could take a look at my configurations and let me know if I did, I would appreciate it. - The Matrix homeserver where the appservice is registered is `mx.scalie.zone` - The bot is hosted on my server, `lightning-mx.68degrees.no` - I only have one profile picture (no community specific ones) on Fluxer. - I am not using Docker. - Debian 13, Go 1.24, Lightning installed 2026年06月24日 Click each to expand them: <details> <summary><u>lightning.toml</u></summary> ```toml database = "(redacted)" prefix = "br!" (Two other Discord plugins stripped from here) [[plugins]] type = "discord" name = "fluxer-scaliebridge" config.token = "(redacted)" config.api_host = "api.fluxer.app" config.cdn_host = "fluxerusercontent.com" config.frontend = "web.fluxer.app" [[plugins]] type = "matrix" name = "matrix-scaliebridge" config.homeserver = "mx.scalie.zone" config.proxy_url = "https://lightning-mx.68degrees.no/matrix" config.proxy_port = "40995" config.as_url = "https://lightning-mx.68degrees.no" config.as_local = "scaliebridge" config.as_token = "(redacted)" config.hs_token = "(redacted)" ``` </details> <details> <summary><u>Appservice registration YAML</u></summary> ```yaml id: "ScalieZone Lightning Bridge" url: https://lightning-mx.68degrees.no as_token: (redacted) hs_token: (redacted) sender_localpart: scaliebridge namespaces: users: - exclusive: true regex: "@_lightning_.*" rate_limited: false ``` </details> <details> <summary><u>nginx</u></summary> ```nginx server { listen 443 ssl; http2 on; server_name lightning-mx.68degrees.no; ssl_certificate (redacted); ssl_certificate_key (redacted); # Max file upload size client_max_body_size 512M; # Forward requests to Lightning location /matrix/ { proxy_pass http://127.0.0.1:40995$request_uri; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 300s; proxy_send_timeout 300s; } location / { proxy_pass http://127.0.0.1:5000$request_uri; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; } } ``` </details> Also, in case it helps, there is an error related to my Fluxer avatar in the log: <details> <summary><u>Lightning log</u></summary> ``` 18:32:28 main.go:33: bridge: bot started 18:32:28 client.go:101: matrix: appservice ready at https://matrix.to/#/@scaliebridge:mx.scalie.zone 18:32:28 proxy.go:51: matrix: file proxy listening at :40995 and https://lightning-mx.68degrees.no/matrix 18:32:30 plugin.go:64: discord: ready as Hambot in 1 servers! 18:32:30 plugin.go:65: discord: invite at (redacted) 18:32:30 plugin.go:64: discord: ready as Hambot in 0 servers! 18:32:30 plugin.go:65: discord: invite at (redacted) 18:32:30 plugin.go:64: discord: ready as ScalieBridge in 0 servers! 18:32:30 plugin.go:65: discord: invite at (redacted) 18:33:29 gateway.go:371: discord: socket error, reconnecting: websocket: close 1000 (normal) 18:33:31 gateway.go:287: discord: connection resumed 19:43:46 bridge.go:204: bridge: EditMessage failed in fluxer-scaliebridge::1516619413405569027: Discord API Error: PATCH /v1/webhooks/1519756256598818816/3Ye2sbN7hiKsun1UjQfjHFjgB3zHjz1m6buulPMJZDUnHJd0FphSOC9A6r4JFBCB/messages/1519759980276752384 status 403 code 403; 19:51:18 outgoing.go:115: matrix: upload failed for https://fluxerusercontent.com/avatars/1473736904463351890/31796b3d.png: M_UNKNOWN (HTTP 500): Internal server error 19:51:18 bridge.go:42: bridge: panic on create in "matrix-scaliebridge::!khoUeIx6hgRnrAQC-vfqVNo72hYKLszdEmq66RjhJXE": runtime error: invalid memory address or nil pointer dereference goroutine 1355 [running]: runtime/debug.Stack() /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/runtime/debug/stack.go:26 +0x64 main.main.bridgeCreate.func3.1.1() /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/cmd/lightning/bridge.go:42 +0x3c panic({0x5f7580?, 0xcfa150?}) /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/runtime/panic.go:860 +0x12c codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).getClient(0x7f574a0540, 0x7f5748a370) /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/pkg/platforms/matrix/client.go:122 +0xf8 codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).SendMessage(0x7f574a0540, 0x7f5748a370, 0x7f57708340) /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/pkg/platforms/matrix/plugin.go:78 +0x58 codeberg.org/jersey/lightning/pkg/lightning.(*Bot).SendMessage(0x0?, 0x7f577c5e68, 0x7f57708340) /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/pkg/lightning/methods.go:50 +0xd8 main.main.bridgeCreate.func3.1() /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.9/cmd/lightning/bridge.go:49 +0x124 sync.(*WaitGroup).Go.func1() /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/sync/waitgroup.go:258 +0x48 created by sync.(*WaitGroup).Go in goroutine 1354 /opt/lightning/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-arm64/src/sync/waitgroup.go:238 +0x70 20:15:57 gateway.go:287: discord: connection resumed ``` </details> Thank you very much in advance.
216 KiB

hi there! it's nice to see someone else dealing with the matrix side of the bot

However, when I send messages from Fluxer, the bot keeps updating my profile picture on the Matrix side.

this also seems to happen with bolt, so this is definitely a bug. note that i'm currently rewriting the matrix code for lightning in #200, so any changes here are likely to land there before they get to develop, though i wouldn't recommend running that branch yet.

Debian 13, Go 1.24, Lightning installed 2026年06月24日

it seems as though you've managed to install v0.8.9 instead of the latest commit off develop (i should really make a release at this point, so this is my fault). can you try installing codeberg.org/jersey/lightning/cmd/lightning@8565d1a15c? even if that doesn't fix the issue for you (as it seems to also happen for me), it still features a number of fixes you may want.

hi there! it's nice to see someone else dealing with the matrix side of the bot > However, when I send messages from Fluxer, the bot keeps updating my profile picture on the Matrix side. this also seems to happen with bolt, so this is definitely a bug. note that i'm currently rewriting the matrix code for lightning in #200, so any changes here are likely to land there before they get to develop, though i wouldn't recommend running that branch yet. > Debian 13, Go 1.24, Lightning installed 2026年06月24日 it seems as though you've managed to install v0.8.9 instead of the latest commit off develop (i should really make a release at this point, so this is my fault). can you try installing `codeberg.org/jersey/lightning/cmd/lightning@8565d1a15c`? even if that doesn't fix the issue for you (as it seems to also happen for me), it still features a number of fixes you may want.
Author
Copy link

Hey Jersey, thanks for getting back to me so quickly. In that case I'll just wait patiently for a fix.
Is there perhaps some way I can disable avatars in the meantime?

Also appreciate the tip about the version I'm running, I was following this documentation and completely missed the part where it says using the latest git commit.

I'm unfamiliar with Go.
Do I just re-run the same go install command with the latest commit in Lightning's directory, and it'll update the existing install?

Cheers.

Hey Jersey, thanks for getting back to me so quickly. In that case I'll just wait patiently for a fix. Is there perhaps some way I can disable avatars in the meantime? Also appreciate the tip about the version I'm running, I was following <a href="https://williamhorning.dev/lightning/bridge/hosting" target="_blank">this documentation</a> and completely missed the part where it says using the latest git commit. I'm unfamiliar with Go. Do I just re-run the same `go install` command with the latest commit in Lightning's directory, and it'll update the existing install? Cheers.

@ridge wrote in #213 (comment):

Hey Jersey, thanks for getting back to me so quickly. In that case I'll just wait patiently for a fix. Is there perhaps some way I can disable avatars in the meantime?

not currently, no. i can try and see about getting that branched merged sooner, though i am on vacation and things are a bit hectic over here

Also appreciate the tip about the version I'm running, I was following this documentation and completely missed the part where it says using the latest git commit.

yeah, the documentation could definitely be reworked and is something i'm hoping to do once i get closer to calling something a v0.9.0

I'm unfamiliar with Go. Do I just re-run the same go install command with the latest commit in Lightning's directory, and it'll update the existing install?

yeah, that should do the trick, assuming you used a similar go install command to initially install the bot

@ridge wrote in https://codeberg.org/jersey/lightning/issues/213#issuecomment-18078047: > Hey Jersey, thanks for getting back to me so quickly. In that case I'll just wait patiently for a fix. Is there perhaps some way I can disable avatars in the meantime? not currently, no. i can try and see about getting that branched merged sooner, though i am on vacation and things are a bit hectic over here > Also appreciate the tip about the version I'm running, I was following [this documentation](https://williamhorning.dev/lightning/bridge/hosting) and completely missed the part where it says using the latest git commit. yeah, the documentation could definitely be reworked and is something i'm hoping to do once i get closer to calling something a v0.9.0 > I'm unfamiliar with Go. Do I just re-run the same `go install` command with the latest commit in Lightning's directory, and it'll update the existing install? yeah, that should do the trick, assuming you used a similar `go install` command to initially install the bot
Author
Copy link

Great.
I installed it as the page suggested (though, latest instead of the latest commit), so just wanted to make sure the update process was the same. Thanks.

It's complaining about the database being the wrong version after updating.

23:02:09 main.go:45: bridge: database version must be d0.8.4 or higher. try running v0.8.9 or earlier to migrate your data.

Either way, no rush at all with the update. I'll keep an eye on the project, and I hope you enjoy your vacation!

Great. I installed it as the page suggested (though, latest instead of the latest commit), so just wanted to make sure the update process was the same. Thanks. It's complaining about the database being the wrong version after updating. ``` 23:02:09 main.go:45: bridge: database version must be d0.8.4 or higher. try running v0.8.9 or earlier to migrate your data. ``` Either way, no rush at all with the update. I'll keep an eye on the project, and I hope you enjoy your vacation!
Author
Copy link

Managed to get the database up to speed by upgrading to cc16ea2037 first, then the latest commit a60e2122b7

All good now :)

Managed to get the database up to speed by upgrading to https://codeberg.org/jersey/lightning/commit/cc16ea2037f4e14f2180946675bc2b066d8ba58d first, then the latest commit https://codeberg.org/jersey/lightning/commit/a60e2122b7b06c105d701a6569eec73996f2c238 All good now :)
jersey added reference mautrix-fork 2026年07月05日 20:10:01 +02:00

@ridge would you be able to try #200? that might fix things for you here

@ridge would you be able to try #200? that might fix things for you here
Author
Copy link

I gave it a shot, and somehow it still seems to happen. I think I installed the Mautrix fork correctly but please let me know if I didn't.

lightning-bridge@mhaura:~$ go install codeberg.org/jersey/lightning/cmd/lightning@mautrix-fork
go: codeberg.org/jersey/lightning@v0.8.10-0.20260706025451-d76258bfb0f6 requires go >= 1.26.0; switching to go1.26.4
go: downloading github.com/BurntSushi/toml v1.6.0
go: downloading github.com/jackc/pgx/v5 v5.10.0
go: downloading github.com/gorilla/websocket v1.5.3
go: downloading github.com/mazznoer/csscolorparser v0.1.8
go: downloading github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.35
go: downloading github.com/yuin/goldmark v1.8.2
go: downloading google.golang.org/protobuf v1.36.11
go: downloading golang.org/x/net v0.56.0
go: downloading github.com/jackc/puddle/v2 v2.2.2
go: downloading github.com/jackc/pgpassfile v1.0.0
go: downloading github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761
go: downloading golang.org/x/text v0.38.0
go: downloading golang.org/x/sync v0.21.0

Furthermore, using this build I'm also not receiving messages from Matrix anymore. Nothing noteworthy to me in the terminal output. Invite links redacted.

lightning-bridge@mhaura:~$ ./lightning 
17:52:43 main.go:48: bridge: bot started
17:52:43 client.go:45: matrix: appservice ready
17:52:44 gateway.go:283: discord: Hambot ready in 0 guilds
17:52:44 gateway.go:283: discord: ScalieBridge ready in 0 guilds
17:52:44 gateway.go:283: discord: Hambot ready in 1 guilds
17:53:44 gateway.go:342: discord: socket error, reconnecting: websocket: close 1000 (normal)
17:53:45 gateway.go:288: discord: connection resumed
17:54:25 outgoing.go:116: matrix: upload failed for https://fluxerusercontent.com/avatars/1473736904463351890/31796b3d.png: M_UNKNOWN: Internal server error: HTTP 500

Fluxer on the left, Matrix on the right. In Matrix, "Chip via Chip" are messages from Fluxer, I think they appear like that because of the client's PluralKit handling. Otherwise the regular "Chip" display name is me talking from my Matrix account.

bilde

Otherwise Discord <-> Fluxer works fine as usual.

I gave it a shot, and somehow it still seems to happen. I think I installed the Mautrix fork correctly but please let me know if I didn't. ``` lightning-bridge@mhaura:~$ go install codeberg.org/jersey/lightning/cmd/lightning@mautrix-fork go: codeberg.org/jersey/lightning@v0.8.10-0.20260706025451-d76258bfb0f6 requires go >= 1.26.0; switching to go1.26.4 go: downloading github.com/BurntSushi/toml v1.6.0 go: downloading github.com/jackc/pgx/v5 v5.10.0 go: downloading github.com/gorilla/websocket v1.5.3 go: downloading github.com/mazznoer/csscolorparser v0.1.8 go: downloading github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.35 go: downloading github.com/yuin/goldmark v1.8.2 go: downloading google.golang.org/protobuf v1.36.11 go: downloading golang.org/x/net v0.56.0 go: downloading github.com/jackc/puddle/v2 v2.2.2 go: downloading github.com/jackc/pgpassfile v1.0.0 go: downloading github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 go: downloading golang.org/x/text v0.38.0 go: downloading golang.org/x/sync v0.21.0 ``` Furthermore, using this build I'm also not receiving messages from Matrix anymore. Nothing noteworthy to me in the terminal output. Invite links redacted. ``` lightning-bridge@mhaura:~$ ./lightning 17:52:43 main.go:48: bridge: bot started 17:52:43 client.go:45: matrix: appservice ready 17:52:44 gateway.go:283: discord: Hambot ready in 0 guilds 17:52:44 gateway.go:283: discord: ScalieBridge ready in 0 guilds 17:52:44 gateway.go:283: discord: Hambot ready in 1 guilds 17:53:44 gateway.go:342: discord: socket error, reconnecting: websocket: close 1000 (normal) 17:53:45 gateway.go:288: discord: connection resumed 17:54:25 outgoing.go:116: matrix: upload failed for https://fluxerusercontent.com/avatars/1473736904463351890/31796b3d.png: M_UNKNOWN: Internal server error: HTTP 500 ``` Fluxer on the left, Matrix on the right. In Matrix, "Chip via Chip" are messages from Fluxer, I think they appear like that because of the client's PluralKit handling. Otherwise the regular "Chip" display name is me talking from my Matrix account. ![bilde](/attachments/c6b9d118-e973-4a07-b1ba-613b46c922b0) Otherwise Discord <-> Fluxer works fine as usual.
167 KiB

@ridge I think that's because the URL->MXC cache expires, though the behavior you've got seems to confirm this will fix the problem once i change the TTL on that.

as for the messages not coming in from matrix, you likely need to update the port your appservice registration points to, as the bot now uses :5591 instead of :5000

for messages which show "X via X," this is a result of your client displaying MSC4144 per-message profiles for users regardless of if that user's display name is equal to the per-message display name. i guess this is valid behavior according to the spec (but this is stupid and if they're equal clients should just act as though it's unset), though i can change things to keep the per-message profile set only when needed

could you try changing your appservice config and updating to the latest commit on the mautrix-fork branch?

@ridge I think that's because the URL->MXC cache expires, though the behavior you've got seems to confirm this will fix the problem once i change the TTL on that. as for the messages not coming in from matrix, you likely need to update the port your appservice registration points to, as the bot now uses `:5591` instead of `:5000` for messages which show "X via X," this is a result of your client displaying MSC4144 per-message profiles for users regardless of if that user's display name is equal to the per-message display name. i guess this is valid behavior according to the spec (but this is stupid and if they're equal clients should just act as though it's unset), though i can change things to keep the per-message profile set only when needed could you try changing your appservice config and updating to the latest commit on the mautrix-fork branch?
Author
Copy link

Oops, didn't catch the port update. Thanks for letting me know.

I updated the port in my nginx config and restarted nginx (the appservice registration has the URL to my bot, which worked fine when it used port 5000), but they still aren't arriving in Fluxer.

I'm using the same configs as in the original post, aside from the updated port in the nginx config. Would this affect anything?

Nginx config
server {
 listen 443 ssl;
 http2 on;
 server_name lightning-mx.68degrees.no;
 ssl_certificate (redacted);
 ssl_certificate_key (redacted);
 # Max file upload size
 client_max_body_size 512M;
 # Forward requests to Lightning
 location /matrix/ {
 proxy_pass http://127.0.0.1:40995$request_uri;
 proxy_set_header Host $host;
 proxy_set_header X-Forwarded-For $remote_addr;
 proxy_set_header X-Forwarded-Proto $scheme;
 proxy_read_timeout 300s;
 proxy_send_timeout 300s;
 }
 location / {
 proxy_pass http://127.0.0.1:5591$request_uri;
 proxy_set_header Host $host;
 proxy_set_header X-Forwarded-For $remote_addr;
 proxy_set_header X-Forwarded-Proto $scheme;
 }
}

Anyway, the username is displayed in a much better manner now, and the avatar isn't constantly updating. Nice! :)

Oops, didn't catch the port update. Thanks for letting me know. I updated the port in my nginx config and restarted nginx (the appservice registration has the URL to my bot, which worked fine when it used port 5000), but they still aren't arriving in Fluxer. I'm using the same configs as in the original post, aside from the updated port in the nginx config. Would this affect anything? <details> <summary><u>Nginx config</u></summary> ```nginx server { listen 443 ssl; http2 on; server_name lightning-mx.68degrees.no; ssl_certificate (redacted); ssl_certificate_key (redacted); # Max file upload size client_max_body_size 512M; # Forward requests to Lightning location /matrix/ { proxy_pass http://127.0.0.1:40995$request_uri; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 300s; proxy_send_timeout 300s; } location / { proxy_pass http://127.0.0.1:5591$request_uri; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; } } ``` </details> Anyway, the username is displayed in a much better manner now, and the avatar isn't constantly updating. Nice! :)
Author
Copy link

The ss utility says Lightning is listening on :5991 so I tried changing to that.
Now it's starting to backfill messages, but the bot crashes almost immediately:

lightning-bridge@mhaura:~$ ./lightning 
20:46:14 main.go:48: bridge: bot started
20:46:14 client.go:45: matrix: appservice ready
20:46:15 gateway.go:283: discord: Hambot ready in 1 guilds
20:46:15 gateway.go:283: discord: ScalieBridge ready in 0 guilds
20:46:15 gateway.go:283: discord: Hambot ready in 0 guilds
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x38f5b4]
goroutine 443 [running]:
codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).matrixToLightningMentions(0x7f64b78000, 0x0)
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/incoming.go:113 +0x24
codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).matrixToLightningMessage(0x7f64b78000, 0x7f64a38180, 0x7f64cec2d0, {0x7f64b98750?, 0x7f64904201?})
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/incoming.go:70 +0x50c
codeberg.org/jersey/lightning/pkg/platforms/matrix.New.(*matrixPlugin).listenForEvents.func3(0x7f64a38180)
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/events.go:29 +0x34
codeberg.org/jersey/lightning/pkg/platforms/matrix/internal.(*DefaultSyncer).dispatch(0x7f64cf0090, 0x7f64a38180)
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/internal/sync.go:30 +0x84
created by codeberg.org/jersey/lightning/pkg/platforms/matrix/internal.(*AppService).putTransaction in goroutine 475
 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/internal/http.go:64 +0x200

Just before the bot crashed, these messages arrived in Fluxer. They're from 3 hours ago at this point in time.
When I run the bot gain, it tries to backfill seemingly random messages before it crashes again.

bilde

The `ss` utility says Lightning is listening on :5991 so I tried changing to that. Now it's starting to backfill messages, but the bot crashes almost immediately: ``` lightning-bridge@mhaura:~$ ./lightning 20:46:14 main.go:48: bridge: bot started 20:46:14 client.go:45: matrix: appservice ready 20:46:15 gateway.go:283: discord: Hambot ready in 1 guilds 20:46:15 gateway.go:283: discord: ScalieBridge ready in 0 guilds 20:46:15 gateway.go:283: discord: Hambot ready in 0 guilds panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x38f5b4] goroutine 443 [running]: codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).matrixToLightningMentions(0x7f64b78000, 0x0) /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/incoming.go:113 +0x24 codeberg.org/jersey/lightning/pkg/platforms/matrix.(*matrixPlugin).matrixToLightningMessage(0x7f64b78000, 0x7f64a38180, 0x7f64cec2d0, {0x7f64b98750?, 0x7f64904201?}) /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/incoming.go:70 +0x50c codeberg.org/jersey/lightning/pkg/platforms/matrix.New.(*matrixPlugin).listenForEvents.func3(0x7f64a38180) /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/events.go:29 +0x34 codeberg.org/jersey/lightning/pkg/platforms/matrix/internal.(*DefaultSyncer).dispatch(0x7f64cf0090, 0x7f64a38180) /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/internal/sync.go:30 +0x84 created by codeberg.org/jersey/lightning/pkg/platforms/matrix/internal.(*AppService).putTransaction in goroutine 475 /opt/lightning/go/pkg/mod/codeberg.org/jersey/lightning@v0.8.10-0.20260706165845-cdcd61bc9b0d/pkg/platforms/matrix/internal/http.go:64 +0x200 ``` Just before the bot crashed, these messages arrived in Fluxer. They're from 3 hours ago at this point in time. When I run the bot gain, it tries to backfill seemingly random messages before it crashes again. ![bilde](/attachments/8d13f240-e318-4cfa-9119-cf77f8880f06)
9.9 KiB

@ridge wrote in #213 (comment):

The ss utility says Lightning is listening on :5991 so I tried changing to that. Now it's starting to backfill messages, but the bot crashes almost immediately:

Just before the bot crashed, these messages arrived in Fluxer. They're from 3 hours ago at this point in time. When I run the bot gain, it tries to backfill seemingly random messages before it crashes again.

the backfill behavior seems about right, can you try updating to the latest commit on that branch and see if things work better with that?

@ridge wrote in https://codeberg.org/jersey/lightning/issues/213#issuecomment-18691955: > The `ss` utility says Lightning is listening on :5991 so I tried changing to that. Now it's starting to backfill messages, but the bot crashes almost immediately: > > Just before the bot crashed, these messages arrived in Fluxer. They're from 3 hours ago at this point in time. When I run the bot gain, it tries to backfill seemingly random messages before it crashes again. the backfill behavior seems about right, can you try updating to the latest commit on that branch and see if things work better with that?
Author
Copy link

Fantastic. It just backfilled everything recent and is relaying messages between both services now. Running stable for 10 minutes now.
Thanks so much!

I know it's unrelated to this issue, but one thing I have noticed (which has always been the case) is that images from Matrix arrive in Fluxer as attachments, not inline images.
bilde

The bot is also relaying my own messages back to Fluxer.

bilde

Should I open separate issues for these?

Fantastic. It just backfilled everything recent and is relaying messages between both services now. Running stable for 10 minutes now. Thanks so much! I know it's unrelated to this issue, but one thing I have noticed (which has always been the case) is that images from Matrix arrive in Fluxer as attachments, not inline images. ![bilde](/attachments/53b53dd7-20b1-4f1c-98bd-8093d9d73ac6) The bot is also relaying my own messages back to Fluxer. ![bilde](/attachments/4945a794-3b95-4036-9e76-168987da6b60) Should I open separate issues for these?

@ridge wrote in #213 (comment):

Fantastic. It just backfilled everything recent and is relaying messages between both services now. Running stable for 10 minutes now. Thanks so much!

I know it's unrelated to this issue, but one thing I have noticed (which has always been the case) is that images from Matrix arrive in Fluxer as attachments, not inline images.

i'm inclined to believe this is a consequence of something wrong with the file proxy. could you download the image and open it in a text editor?

The bot is also relaying my own messages back to Fluxer.

this should be fixed in the latest commit

@ridge wrote in https://codeberg.org/jersey/lightning/issues/213#issuecomment-18697982: > Fantastic. It just backfilled everything recent and is relaying messages between both services now. Running stable for 10 minutes now. Thanks so much! > > I know it's unrelated to this issue, but one thing I have noticed (which has always been the case) is that images from Matrix arrive in Fluxer as attachments, not inline images. i'm inclined to believe this is a consequence of something wrong with the file proxy. could you download the image and open it in a text editor? > The bot is also relaying my own messages back to Fluxer. this should be fixed in the latest commit
Author
Copy link

Ah, yes. I think I was too tired last night to notice the file size of those "images".

You're right, they're all HTTP 502 codes from nginx.
With my current config (no changes from original post), images do get relayed correctly with the previous version of the Matrix plugin, before the Mautrix fork.

Ah, yes. I think I was too tired last night to notice the file size of those "images". You're right, they're all HTTP 502 codes from nginx. With my current config (no changes from original post), images do get relayed correctly with the previous version of the Matrix plugin, before the Mautrix fork.

alright, that makes a lot more sense. in that case, i'd make sure your nginx config points to the right port and check its logs as well, as that's the last thing i could think of

alright, that makes a lot more sense. in that case, i'd make sure your nginx config points to the right port and check its logs as well, as that's the last thing i could think of
Author
Copy link

Sure thing. Thanks for all your help so far, I really appreciate it. Messages aren't echoed back now.

Been trying a few different things, restarting the bot, nginx, checking configs, etc. but I can't really seem to figure it out.

I remember it was receiving images from Matrix fine on the develop branch. I didn't change my Nginx config other than updating for the new appservice port, 5991.

Nginx access log seems normal, so does the Nginx error, but maybe you or someone else can see something I don't. The client IP is Vultr, where Fluxer stores media.

2026年07月07日 21:31:25 [error] 669803#669803: *107 connect() failed (111: Connection refused) while connecting to upstream, client: 140.82.2.14, server: lightning-mx.68degrees.no, request: "GET /matrix/mxc%3A%2F%2Ftchncs.de%2Fbc03a8d4a6c1132b93e9c629f70e57609032c87e2022062160586211328 HTTP/1.1", upstream: "http://127.0.0.1:40995/matrix/mxc%3A%2F%2Ftchncs.de%2Fbc03a8d4a6c1132b93e9c629f70e57609032c87e2022062160586211328", host: "lightning-mx.68degrees.no"

One thing I noticed, this happens with both the develop and mautrix-fork branch so I assume it's not a big deal, but ss reports that nothing is listening on :40995 (the port I set config.proxy_port to).
Is that correct behaviour? Lightning only listens on :5991

Otherwise, everything matches between my lightning.toml and nginx config.
I'll keep checking in on the bot and logs while I'm at the keyboard, and keep you posted if we find anything.

Sure thing. Thanks for all your help so far, I really appreciate it. Messages aren't echoed back now. Been trying a few different things, restarting the bot, nginx, checking configs, etc. but I can't really seem to figure it out. I remember it was receiving images from Matrix fine on the develop branch. I didn't change my Nginx config other than updating for the new appservice port, 5991. Nginx access log seems normal, so does the Nginx error, but maybe you or someone else can see something I don't. The client IP is Vultr, where Fluxer stores media. ``` 2026年07月07日 21:31:25 [error] 669803#669803: *107 connect() failed (111: Connection refused) while connecting to upstream, client: 140.82.2.14, server: lightning-mx.68degrees.no, request: "GET /matrix/mxc%3A%2F%2Ftchncs.de%2Fbc03a8d4a6c1132b93e9c629f70e57609032c87e2022062160586211328 HTTP/1.1", upstream: "http://127.0.0.1:40995/matrix/mxc%3A%2F%2Ftchncs.de%2Fbc03a8d4a6c1132b93e9c629f70e57609032c87e2022062160586211328", host: "lightning-mx.68degrees.no" ``` One thing I noticed, this happens with both the develop and mautrix-fork branch so I assume it's not a big deal, but `ss` reports that nothing is listening on :40995 (the port I set config.proxy_port to). Is that correct behaviour? Lightning only listens on :5991 Otherwise, everything matches between my lightning.toml and nginx config. I'll keep checking in on the bot and logs while I'm at the keyboard, and keep you posted if we find anything.

@ridge wrote in #213 (comment):

One thing I noticed, this happens with both the develop and mautrix-fork branch so I assume it's not a big deal, but ss reports that nothing is listening on :40995 (the port I set config.proxy_port to). Is that correct behaviour? Lightning only listens on :5991

yeah, that's correct. at some point (no clue when, in all honesty), proxy_port got killed in favor of the top level addr, which defaults to :5991. if you tell the proxy to look at :5991, does that fix things?

@ridge wrote in https://codeberg.org/jersey/lightning/issues/213#issuecomment-18768899: > One thing I noticed, this happens with both the develop and mautrix-fork branch so I assume it's not a big deal, but `ss` reports that nothing is listening on :40995 (the port I set config.proxy_port to). Is that correct behaviour? Lightning only listens on :5991 yeah, that's correct. at some point (no clue when, in all honesty), proxy_port got killed in favor of the top level `addr`, which defaults to `:5991`. if you tell the proxy to look at `:5991`, does that fix things?
Author
Copy link

Ha.. I thought about trying to direct the proxy to 5991, but just didn't do it for some reason. That worked. Thanks!

Ha.. I thought about trying to direct the proxy to 5991, but just didn't do it for some reason. That worked. Thanks!

alright, in that case, is there anything left that isn't working on that branch (well, now it's merged into develop) for you?

alright, in that case, is there anything left that isn't working on that branch (well, now it's merged into `develop`) for you?
Author
Copy link

Not sure if it's a known issue, but message edits are not bridged from Matrix to Fluxer. They do get bridged the other way around, from Fluxer to Matrix.

Otherwise everything is just perfect. We're really happy to have this bridge running.

Not sure if it's a known issue, but message edits are not bridged from Matrix to Fluxer. They do get bridged the other way around, from Fluxer to Matrix. Otherwise everything is just perfect. We're really happy to have this bridge running.

could you try edd6d532c4? that might fix edits

could you try edd6d532c46565c4a18df397fca34fd0cb5e24bf? that might fix edits
Author
Copy link

Gave it a shot, but no change unfortunately. Can't see anything in nginx or Lightning log either.

Editing messages on Fluxer still works, but editing on Matrix doesn't show up on Fluxer.

bilde

Gave it a shot, but no change unfortunately. Can't see anything in nginx or Lightning log either. Editing messages on Fluxer still works, but editing on Matrix doesn't show up on Fluxer. ![bilde](/attachments/9329abc2-21c2-491b-a786-83a8e2b1daca)
jersey changed title from (削除) Bot repeatedly updating avatar from Fluxer user on Matrix (削除ここまで) to matrix avatar and edit bugs 2026年07月08日 05:54:30 +02:00

can you try a412abbe50? i believe that should fix things, or it does for me locally

can you try a412abbe501c1a49ae8b272215623d5a9a55c24e? i believe that should fix things, or it does for me locally
Author
Copy link

Yes, works a charm. No more issues now to my knowledge.
Nice, and thank you! :)

Yes, works a charm. No more issues now to my knowledge. Nice, and thank you! :)

thanks for sticking with me through this!

thanks for sticking with me through this!
Sign in to join this conversation.
mautrix-fork
develop
mautrix-fork
pluralkit
xmpp
v0.8.9
v0.8.8
v0.8.7
v0.8.6
v0.8.5
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.8.0-rc.12
v0.8.0-rc.11
v0.8.0-rc.10
v0.8.0-rc.9
v0.8.0-rc.8
v0.8.0-rc.7
v0.8.0-rc.6
v0.8.0-rc.5
v0.8.0-rc.4
v0.8.0-rc.3
v0.8.0-rc.2
v0.8.0-rc.1
v0.8.0-beta.13
v0.8.0-beta.12
v0.8.0-beta.11
v0.8.0-beta.10
v0.8.0-beta.9
v0.8.0-beta.8
v0.8.0-beta.7
v0.8.0-beta.6
v0.8.0-beta.5
v0.8.0-beta.4
v0.8.0-beta.3
v0.8.0-beta.2
v0.8.0-beta.1
v0.8.0-alpha.13
v0.8.0-alpha.12
v0.8.0-alpha.11
0.8.0-alpha.10
0.8.0-alpha.9
0.8.0-alpha.8
0.8.0-alpha.7
0.8.0-alpha.6
0.8.0-alpha.5
0.8.0-alpha.4
0.8.0-alpha.3
0.8.0-alpha.2
0.8.0-alpha.1
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.2a
0.6.2
0.6.1
0.6.0
0.5.8
0.5.7
0.5.6
0.5.5
0.4.13
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
Labels
Clear labels
scope
bolt
anything specific to the hosted product offered as bolt
scope
bridge
anything specific to the bridge application itself
scope
core
anything affecting the main framework
scope
discord
anything specific to the discord plugin
scope
epic
something which requires a large set of changes (new platforms, new types of things to bridge, etc.)
scope
irc
scope
matrix
anything specific to the matrix plugin
scope
osmium
scope
stoat
anything specific to the stoat plugin
scope
telegran
anything specific to the telegram plugin
status
blocked
this is blocked due to something else
status
deferred
status
question
further information is requested or a reproduction is needed
type
breaking
this would change something in a public api
type
bug
Something isn't working
type
build
the docker images and related scripts i think
type
dependencies
dependency-related things
type
documentation
Improvements or additions to documentation
type
enhancement
New feature or request
type
regression
a bug introduced by an update
Milestone
Clear milestone
No items
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jersey/lightning#213
Reference in a new issue
jersey/lightning
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?