Password reset error when using Sqlite
On a newly created Ash project using Sqlite I get the following error when attempting a password reset:
[debug] QUERY ERROR source="users" db=0.0ms idle=444.2ms
UPDATE "users" AS u0 SET "confirmed_at" = CAST(CAST(? AS TEXT) AS TEXT), "hashed_password" = CAST((CASE WHEN REGEXP_REPLACE(REGEXP_REPLACE(?, ' +$', ''), '^ +', '') = ? THEN NULL ELSE REGEXP_REPLACE(REGEXP_REPLACE(?, ' +$', ''), '^ +', '') END) AS TEXT) WHERE (CAST(u0."id" AS TEXT) = CAST(? AS TEXT)) RETURNING "id", "confirmed_at", "email", "hashed_password" [~U[2025-08-20 19:00:06.675262Z], "$2b$12$fFi1OtgfaPfaDBLQHyz3h.fS3bjMSUUgXVMl9h5UVBm8rocZELAea", "", "$2b$12$0C5BBQvboelGhbfi3n/3geoEf/0AQbwMOEZlpWNNqoh8btxY/qe1K", "6da84435-84cd-4827-8ec9-55c56b08dc5e"]
The project was generated using the following command (from ash-hq.org):
mix archive.install hex igniter_new --force
mix archive.install hex phx_new 1.8.0 --force
mix igniter.new ash_auth_demo --with phx.new \
--with-args "--database sqlite3" --install ash,ash_phoenix \
--install ash_sqlite,ash_authentication \
--install ash_authentication_phoenix --auth-strategy password \
--auth-strategy magic_link --yes
cd ash_auth_demo && mix ash.setup
I believe there is no REGEXP_REPLACE function in Sqlite? The same project using Postgres works as expected.
1 Reply
Can you open an issue against ash_sqlite? We need to customize that expression to work properly there since it uses some shared logic as ash_postgres