Skip to content

PhoenixKit 2.22.12: Sign-up no longer crashes when the country is found

PhoenixKit 2.22.12 fixes registration on sites with registration geolocation tracking turned on.

The registration country is stored as a two-letter code, but the location lookup returned the full country name, such as “United States”. Once the lookup started finding real visitor addresses, every successful lookup crashed the sign-up form in the middle of registration. The lookup now also fetches the two-letter code, and only a real two-letter code is saved.

In the admin, the user detail page and the Users list turn the stored code back into the full country name when they show the user’s location.

Full release notes: PhoenixKit 2.22.12

2.22.12 · 9 September 2026

Fixed

  • A successful geolocation lookup crashed registration mid-signup. registration_country is a 2-char column by design (ISO 3166-1 alpha-2), but Geolocation.lookup_location/1 only ever fetched and returned the full country name (e.g. “United States”), and register_user_with_geolocation/2 wrote that straight into the column. This had gone unnoticed because geolocation never actually succeeded in production before the 2.22.10/2.22.11 IP fixes — once it started resolving real visitor IPs, every successful lookup raised an unhandled Postgres string_data_right_truncation and killed the registration LiveView mid-signup. Geolocation now also fetches the ISO alpha-2 code from both providers, and only a genuine 2-letter code is written to registration_country.
  • registration_country‘s changeset validation didn’t match its own column. It allowed up to 100 characters — copied from registration_region/registration_city — instead of the 2 the column actually holds, so an oversized value reached Postgres as “valid” and only failed at the SQL layer instead of a normal {:error, changeset}. Now validated at max: 2, matching the column, as defense-in-depth for any caller.
  • Admin UI locations (user_details‘s and the Users list’s “City, Region, Country” text) now expand the stored ISO code back to a full country name via PhoenixKit.Utils.CountryData.country_name/1 for display.

PhoenixKit 2.22.12. Install or update: {:phoenix_kit, "~> 2.22"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.