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

[Bug] Tries to create existing amin account #544

Open
henri9813 opened this issue May 9, 2024 · 5 comments
Open

[Bug] Tries to create existing amin account #544

henri9813 opened this issue May 9, 2024 · 5 comments

Comments

@henri9813
Copy link

Describe the bug
At each appflowy cloud start

appflowy_cloud-1  | {"timestamp":"2024-05-09T11:39:38.105850Z","level":"ERROR","fields":{"error":"code: 400, msg:User already registered, error_id: None"},"target":"gotrue::api","span":{"name":"sign_up"},"spans":[{"name":"sign_up"}]}

When we configure gotrue with:

      - GOTRUE_DISABLE_SIGNUP=true

Appflowy is not able to start at all

appflowy_cloud-1  | {"timestamp":"2024-05-09T11:38:20.383807Z","level":"ERROR","fields":{"error":"code: 403, msg:Signups not allowed for this instance, error_id: None"},"target":"gotrue::api","span":{"name":"sign_up"},"spans":[{"name":"sign_up"}]}
appflowy_cloud-1  | Error: Failed to initialize application state: code: 403, msg:Signups not allowed for this instance, error_id: None
appflowy_cloud-1  | 
appflowy_cloud-1  | Stack backtrace:
appflowy_cloud-1  |    0: anyhow::error::<impl anyhow::Error>::msg
appflowy_cloud-1  |    1: tokio::task::local::LocalSet::run_until::{{closure}}
appflowy_cloud-1  |    2: appflowy_cloud::main
appflowy_cloud-1  |    3: std::sys_common::backtrace::__rust_begin_short_backtrace
appflowy_cloud-1  |    4: main
appflowy_cloud-1  |    5: <unknown>
appflowy_cloud-1  |    6: __libc_start_main
appflowy_cloud-1  |    7: _start

To Reproduce
Steps to reproduce the behavior:

  1. Start appflowy docker-compose.

Expected behavior
User already exist, no error triggered.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context

  • Environment [e.g. flutter doctor -v or rustup show]
    Add any other context about the problem here.
@ppluciennik
Copy link

This patch appears to fix the startup issue:

diff --git a/src/application.rs b/src/application.rs
index 69e093c..0bc9470 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -320,6 +320,7 @@ async fn setup_admin_account(
     Err(err) => {
       if let app_error::gotrue::GoTrueError::Internal(err) = err {
         match (err.code, err.msg.as_str()) {
+          (403, "Signups not allowed for this instance") => Ok(gotrue_admin),
           (400, "User already registered") => {
             info!("Admin user already registered");
             Ok(gotrue_admin)

@henri9813
Copy link
Author

Hello,

Should we not just check if the admin account exists before trying to create it and wait an error ?

@ppluciennik
Copy link

ppluciennik commented Jun 17, 2024

That's better option in my opinion.

@Killian-Aidalinfo
Copy link

Hello, I have the same problem, is there a way around it?

@henri9813
Copy link
Author

I will learn rust and then propose a patch if no one do this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants