signal-cli-rest-api
signal-cli-rest-api copied to clipboard
Issue with latest release: Username must contain a '.'
The problem
I am a Home Assistant user, running signal-cli-rest-api in a docker container. I recently updated the signal rest api to the latest release. I am now getting an error upon attempting a send, either via Home Assistant or via a curl command.
Is there a new username requirement?
java.lang.RuntimeException: org.signal.libsignal.usernames.MissingSeparatorException: Username must contain a '.'
at org.asamk.signal.manager.helper.RecipientHelper.resolveRecipientByUsernameOrLink(RecipientHelper.java:105)
at org.asamk.signal.manager.helper.RecipientHelper.resolveRecipient(RecipientHelper.java:93)
at org.asamk.signal.manager.internal.ManagerImpl.sendMessage(ManagerImpl.java:622)
at org.asamk.signal.manager.internal.ManagerImpl.sendMessage(ManagerImpl.java:598)
at org.asamk.signal.manager.internal.ManagerImpl.sendMessage(ManagerImpl.java:726)
at org.asamk.signal.commands.SendCommand.handleCommand(SendCommand.java:245)
at org.asamk.signal.commands.CommandHandler.handleLocalCommand(CommandHandler.java:35)
at org.asamk.signal.App.handleLocalCommand(App.java:278)
at org.asamk.signal.App.handleCommand(App.java:179)
at org.asamk.signal.App.init(App.java:144)
at org.asamk.signal.Main.main(Main.java:56)
at java.base@21/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: org.signal.libsignal.usernames.MissingSeparatorException: Username must contain a '.'
at org.signal.libsignal.internal.Native.Username_Hash(Native Method)
at org.signal.libsignal.usernames.Username.lambda$hash$6(Username.java:148)
at org.signal.libsignal.internal.FilterExceptions.filterExceptions(FilterExceptions.java:143)
at org.signal.libsignal.usernames.Username.hash(Username.java:148)
at org.signal.libsignal.usernames.Username.
Are you using the latest released version?
- [X] Yes
Have you read the troubleshooting page?
- [X] Yes
What type of installation are you running?
signal-cli-rest-api Docker Container
In which mode are you using the docker container?
Native Mode
What's the architecture of your host system?
x86-64
Additional information
No response
That looks like a upstream behavioral change in libsignal. I guess you need to change your username to match that requirement.
OK, I found a new requirement to have a username in the signal frontend, which I have added. I removed my signal-cli-rest-api docker container and started. Still getting the error. Do I need to go through registration again? Thanks!
How/where did you set the username?
I set it in the Signal app under Settings >> Profile. However, doing this has still not solved the original issue for me.
From: Bernhard B. @.> Sent: Monday, June 17, 2024 1:15:58 PM To: bbernhard/signal-cli-rest-api @.> Cc: Ryan Schilmoeller @.>; Author @.> Subject: Re: [bbernhard/signal-cli-rest-api] Issue with latest release: Username must contain a '.' (Issue #547)
How/where did you set the username?
— Reply to this email directly, view it on GitHubhttps://github.com/bbernhard/signal-cli-rest-api/issues/547#issuecomment-2174034080, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGBMQIVWA5ME3BBP3O45ATTZH4RV5AVCNFSM6AAAAABJI2IEN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZUGAZTIMBYGA. You are receiving this because you authored the thread.Message ID: @.***>
I guess you are using a linked device?
Yes, using a linked device. Scanned with QR code. Should I be doing something different?
Unfortunately, I do not have much experience with linked devices. So, not really sure how signal-cli syncs with the primary device. Do you periodically call the receive endpoint?
You could also try to set the username via the API: https://bbernhard.github.io/signal-cli-rest-api/#/Accounts/post_v1_accounts__number__username
Hello, I am having the exact same issue, how can this be addressed.
I register my number first on the phone app and then I use the QR to link it to docker instance.
And now when I send a message to a group the (Username must contain a '.') problem happens. Regular messages to individual recipients work.
Thanks for your help and time.
Sorry but, is this being addressed?
thanks for your time.
The Username must contain a '.' comes from the upstream libsignal-client (see https://github.com/signalapp/libsignal/blob/c6a1e5cec6a30759716a33d0586c84ef6f4f613e/rust/usernames/src/error.rs#L8).
But if you are sending the message to a group, that shouldn't matter, as you don't specify any username, but a group id instead. Are you sure that you are sending the message to a group?
The error still there, I do not mind disclosing the group id (It is a test) because maybe that is part of the error, I dont know if it is properly formatted.
I have set a profile name and a username. I don't know what else could it be that is causing this error. Also, I did not link the device from a phone, it is first registered on my server. Please help!
curl -X POST http://localhost:8080/v2/send -H "Content-Type: application/json" -d '{"message":"Hello!","number":"+xxxxxxxxxx","recipients":["x/EQYOwHaVSYAks4VQndXdc47Z8R9HmN3+ZE87Ajdfc="]}'
{"error":"java.lang.RuntimeException: org.signal.libsignal.usernames.MissingSeparatorException: Username must contain a '.'\n\tat org.asamk.signal.manager.helper.RecipientHelper.resolveRecipientByUsernameOrLink(RecipientHelper.java:106)\n\tat org.asamk.signal.manager.helper.RecipientHelper.resolveRecipient(RecipientHelper.java:94)\n\tat org.asamk.signal.manager.internal.ManagerImpl.sendMessage(ManagerImpl.java:624)\n\tat org.asamk.signal.manager.internal.ManagerImpl.sendMessage(ManagerImpl.java:600)\n\tat org.asamk.signal.manager.internal.ManagerImpl.sendMessage(ManagerImpl.java:735)\n\tat org.asamk.signal.commands.SendCommand.handleCommand(SendCommand.java:245)\n\tat org.asamk.signal.commands.CommandHandler.handleLocalCommand(CommandHandler.java:35)\n\tat org.asamk.signal.App.handleLocalCommand(App.java:278)\n\tat org.asamk.signal.App.handleCommand(App.java:179)\n\tat org.asamk.signal.App.init(App.java:144)\n\tat org.asamk.signal.Main.main(Main.java:56)\nCaused by: org.signal.libsignal.usernames.MissingSeparatorException: Username must contain a '.'\n\tat org.signal.libsignal.internal.Native.Username_Hash(Native Method)\n\tat org.signal.libsignal.usernames.Username.lambda$hash$6(Username.java:148)\n\tat org.signal.libsignal.internal.FilterExceptions.filterExceptions(FilterExceptions.java:144)\n\tat org.signal.libsignal.usernames.Username.hash(Username.java:148)\n\tat org.signal.libsignal.usernames.Username.\u003cinit\u003e(Username.java:57)\n\tat org.asamk.signal.manager.helper.RecipientHelper.getUsernameFromUsernameOrLink(RecipientHelper.java:138)\n\tat org.asamk.signal.manager.helper.RecipientHelper.resolveRecipientByUsernameOrLink(RecipientHelper.java:104)\n\t... 10 more\n"}
I had this problem sending messages to groups too. If x/EQYOwHaVSYAks4VQndXdc47Z8R9HmN3+ZE87Ajdfc= is the ID of the group in Signal, that's called the "internal ID" in signal-cli-rest-api. When making REST calls you have to use the signal-cli-rest-api IDs, which are formatted like group.${base64Encode(signalId)}, so yours would be group.eC9FUVlPd0hhVlNZQWtzNFZRbmRYZGM0N1o4UjlIbU4zK1pFODdBamRmYz0=. You can also see these by hitting the /v1/groups/{number} API.
I had this problem sending messages to groups too. If
x/EQYOwHaVSYAks4VQndXdc47Z8R9HmN3+ZE87Ajdfc=is the ID of the group in Signal, that's called the "internal ID" insignal-cli-rest-api. When making REST calls you have to use thesignal-cli-rest-apiIDs, which are formatted likegroup.${base64Encode(signalId)}, so yours would begroup.eC9FUVlPd0hhVlNZQWtzNFZRbmRYZGM0N1o4UjlIbU4zK1pFODdBamRmYz0=. You can also see these by hitting the/v1/groups/{number}API.
Thanks so much, this was the issue. Ty for the quick reply!
So, what about the rest of us who don't send to groups, but to single numbers?
curl -i -X POST -d '{"recipients":["+XXXXXXXXXXX"],"message":"hello","number":"+YYYYYYYYYYY"}' http://localhost:9922/v2/send
In this example, +XXXXXXXXXXX is the recipient's phone number, and +YYYYYYYYYYY is the sender's.
Thanks for the quick reply. It appeared my issue was with the fact that the recipient number had spaces inside it. The error was very confusing, though (which is why I ended up here). So, anyone facing this issue, make sure you clean-up spaces in the phone numbers.