Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Country code regex does not match #6723

Closed
kevinstsauveur opened this issue Sep 15, 2022 · 5 comments · Fixed by #6727
Closed

Error: Country code regex does not match #6723

kevinstsauveur opened this issue Sep 15, 2022 · 5 comments · Fixed by #6727
Labels
A-3PIDs work related to improving login via external identity providers O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems

Comments

@kevinstsauveur
Copy link

Steps to reproduce

  1. Where are you starting? What can you see?
    In the user settings where there is the profile picture, display name, password, email, add email address and phone number.
  2. What do you click?
    When I want to add a phone number, I enter my number and when I click on the add option, an error message appears.

Outcome

What did you expect?

Adding a phone number works.

What happened instead?

1 validation error for msisdnRequestTokenBody country string does not match regex "[A-Z]{2}" (type=value_error.str.regex; pattern=[A-Z]{2})

error image

An invalid error beyond my control occurs.

Your phone model

iPhone 13 Pro

Operating system version

iOS 16

Application version

Element 1.9.5

Homeserver

matrix.org

Will you send logs?

Yes

@kevinstsauveur kevinstsauveur added the T-Defect Something isn't working: bugs, crashes, hangs and other reported problems label Sep 15, 2022
@kevinstsauveur
Copy link
Author

kevinstsauveur commented Sep 15, 2022

I reported the error in the Element IOS channel and a kind user (@Johennes) gave a possible hypothesis of the problem:

This looks like an error from the MSISDN API. I haven't investigated this deeply but it looks like we're not actually forwarding the country code to the API in all cases (see e.g. here).

@Johennes
Copy link
Contributor

Johennes commented Sep 15, 2022

Logs from the rageshake confirm that the error comes from the MSISDN API:

2022-09-14 22:34:47.336 Element[6354:1857359] [MXHTTPClient] #130 - POST _matrix/client/r0/account/3pid/msisdn/requestToken
2022-09-14 22:34:47.482 Element[6354:1857359] [MXHTTPClient] #130 - POST _matrix/client/r0/account/3pid/msisdn/requestToken completed in 146ms
2022-09-14 22:34:47.483 Element[6354:1857359] [MXHTTPClient] Request 0x284de30c0 failed for path: _matrix/client/r0/account/3pid/msisdn/requestToken - HTTP code: 400. Error: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: bad request (400)" UserInfo={NSLocalizedDescription=Request failed: bad request (400), NSErrorFailingURLKey=https://matrix-client.matrix.org/_matrix/client/r0/account/3pid/msisdn/requestToken, com.alamofire.serialization.response.error.data={length = 185, bytes = 0x7b226572 72636f64 65223a22 4d5f494e ... 5a5d7b32 7d29227d }, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x2813ceaa0> { URL: https://matrix-client.matrix.org/_matrix/client/r0/account/3pid/msisdn/requestToken } { Status Code: 400, Headers { ... } }}
2022-09-14 22:34:47.483 Element[6354:1857359] [MXHTTPClient] Error JSONResponse: {
    errcode = "M_INVALID_PARAM";
    error = "1 validation error for MsisdnRequestTokenBody\ncountry\n  string does not match regex \"[A-Z]{2}\" (type=value_error.str.regex; pattern=[A-Z]{2})";
}

@mikelberry
Copy link

I experienced the same issue and reported it here in the Element iOS room and submitted a bug report through the iOS app.

I did: added my phone number with prefilled country code +1 to my profile via iOS app > confirmed my matrix password > submitted

I expected: a success message or one-time passcode to confirm my number and for my phone number to be saved in my profile

I saw: I received an error message the following error message:
1 validation error for MsisdnRequestTokenBody country string does not match regex “[A-Z]{2}” (type=value_error.str.regex; pattern=[A-Z] {2})

Additional info:

  1. This is a newly created account, created through the iOS app
  2. The app is running on a new install of iOS 16

image

Johennes added a commit that referenced this issue Sep 15, 2022
Johennes added a commit that referenced this issue Sep 15, 2022
@Johennes
Copy link
Contributor

The regex error is easily fixed with #6727. Unfortunately, this will still leave you on what appears to be a rate limiting response. As discussed in the Element iOS room yesterday, Element Web has the same problem.

@Johennes
Copy link
Contributor

Update on the rate limiting error: Adding phone numbers is disabled on matrix.org at the moment because the sending of SMS kept being exploited by scammers. Unfortunately, we don't have a timeline for when it will be made available again at this time.

@pixlwave pixlwave added A-3PIDs work related to improving login via external identity providers S-Major Severely degrades major functionality or product features, with no satisfactory workaround O-Occasional Affects or can be seen by some users regularly or most users rarely labels Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-3PIDs work related to improving login via external identity providers O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants