diff --git a/docker-compose-ci.yml b/docker-compose-ci.yml index 4a684b7b..dc4afc2b 100644 --- a/docker-compose-ci.yml +++ b/docker-compose-ci.yml @@ -50,10 +50,7 @@ services: gotrue: restart: on-failure - build: - context: . - dockerfile: docker/gotrue.Dockerfile - image: appflowyinc/gotrue:${GOTRUE_VERSION:-latest} + image: supabase/gotrue:v2.159.1 environment: # There are a lot of options to configure GoTrue. You can reference the example config: # https://github.com/supabase/gotrue/blob/master/example.env diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 68c98e80..98da16c8 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -45,10 +45,7 @@ services: gotrue: restart: on-failure - build: - context: . - dockerfile: docker/gotrue.Dockerfile - image: appflowyinc/gotrue:${GOTRUE_VERSION:-latest} + image: supabase/gotrue:v2.159.1 depends_on: - postgres environment: diff --git a/libs/app-error/src/gotrue.rs b/libs/app-error/src/gotrue.rs index 16099556..3713ce25 100644 --- a/libs/app-error/src/gotrue.rs +++ b/libs/app-error/src/gotrue.rs @@ -85,15 +85,16 @@ impl Display for GoTrueErrorSerde { /// Used to deserialize the response from the gotrue server #[derive(Serialize, Deserialize, Debug, Error)] pub struct GotrueClientError { - pub error: String, + pub error: Option, pub error_description: Option, + pub msg: Option, } impl Display for GotrueClientError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_fmt(format_args!( - "error: {}, description: {:?}", - self.error, self.error_description + "error: {:?}, error_description: {:?}, msg: {:?}", + self.error, self.error_description, self.msg )) } } diff --git a/libs/gotrue-entity/src/dto.rs b/libs/gotrue-entity/src/dto.rs index 707ff264..9274f35d 100644 --- a/libs/gotrue-entity/src/dto.rs +++ b/libs/gotrue-entity/src/dto.rs @@ -105,7 +105,7 @@ pub struct GoTrueSettings { pub mailer_autoconfirm: bool, pub phone_autoconfirm: bool, pub sms_provider: String, - pub mfa_enabled: bool, + pub mfa_enabled: Option, // later version have this field removed pub saml_enabled: bool, } diff --git a/libs/gotrue/src/api.rs b/libs/gotrue/src/api.rs index d7d487a5..cfd77fbb 100644 --- a/libs/gotrue/src/api.rs +++ b/libs/gotrue/src/api.rs @@ -48,9 +48,7 @@ impl Client { pub async fn settings(&self) -> Result { let url: String = format!("{}/settings", self.base_url); let resp = self.client.get(&url).send().await?; - let settings: GoTrueSettings = from_response(resp) - .await - .context(format!("calling {} failed", url))?; + let settings: GoTrueSettings = from_response(resp).await?; Ok(settings) } diff --git a/tests/user/sign_in.rs b/tests/user/sign_in.rs index ffb749c1..d391093d 100644 --- a/tests/user/sign_in.rs +++ b/tests/user/sign_in.rs @@ -7,7 +7,7 @@ async fn sign_in_unknown_user() { let password = "Hello123!"; let c = localhost_client(); let err = c.sign_in_password(&email, password).await.unwrap_err(); - assert_eq!(err.code, ErrorCode::OAuthError); + assert_eq!(err.code, ErrorCode::OAuthError, "{:?}", err); assert!(!err.message.is_empty()); } @@ -24,7 +24,7 @@ async fn sign_in_wrong_password() { .sign_in_password(&email, wrong_password) .await .unwrap_err(); - assert_eq!(err.code, ErrorCode::OAuthError); + assert_eq!(err.code, ErrorCode::OAuthError, "{:?}", err); assert!(!err.message.is_empty()); } @@ -37,7 +37,7 @@ async fn sign_in_unconfirmed_email() { c.sign_up(&email, password).await.unwrap(); let err = c.sign_in_password(&email, password).await.unwrap_err(); - assert_eq!(err.code, ErrorCode::OAuthError); + assert_eq!(err.code, ErrorCode::OAuthError, "{:?}", err); assert!(!err.message.is_empty()); } @@ -88,7 +88,7 @@ async fn sign_in_with_invalid_url() { let c = localhost_client(); match c.sign_in_with_url(url_str).await { Ok(_) => panic!("should not be ok"), - Err(e) => assert_eq!(e.code, ErrorCode::OAuthError), + Err(e) => assert_eq!(e.code, ErrorCode::OAuthError, "{:?}", e), } } diff --git a/tests/user/sign_up.rs b/tests/user/sign_up.rs index 8a683a94..e580806f 100644 --- a/tests/user/sign_up.rs +++ b/tests/user/sign_up.rs @@ -19,10 +19,10 @@ async fn sign_up_invalid_email() { .sign_up(invalid_email, password) .await .unwrap_err(); - assert_eq!(error.code, ErrorCode::InvalidRequest); + assert_eq!(error.code, ErrorCode::OAuthError); assert_eq!( error.message, - "Invalid request:Unable to validate email address: invalid format" + "Unable to validate email address: invalid format" ); } @@ -35,7 +35,7 @@ async fn sign_up_invalid_password() { assert_eq!(error.code, ErrorCode::InvalidRequest); assert_eq!( error.message, - "Invalid request:Password should be at least 6 characters" + "Invalid request:Password should be at least 6 characters." ); }