quivr icon indicating copy to clipboard operation
quivr copied to clipboard

[Bug]: local supabase db reset ,after create a new user,Failed to create user: An error has occurred: Failed to fetch

Open caihexin opened this issue 11 months ago • 7 comments

What happened?

A bug happened image

Relevant log output

No response

Twitter / LinkedIn details

No response

caihexin avatar Mar 08 '24 07:03 caihexin

Hey @caihexin, great to see you back! Hope you're doing well. 😊

Based on the information provided, it seems like you're encountering a "Failed to fetch" error when trying to create a new user in the local Supabase database after resetting it. This error could be due to several reasons, and without more specific details, it's challenging to pinpoint the exact cause. However, here are some potential causes and corresponding solutions:

  1. Network Issues or Incorrect URL: Please ensure that your network connection is stable and that the URL you're using to connect to the Supabase database is correct.

  2. Environment Variables Not Properly Set: After resetting your local Supabase database, ensure that all necessary environment variables, such as POSTHOG_API_KEY, are correctly set. You can verify this by checking the environment variables in your project settings.

  3. Supabase Project Configuration: After resetting your Supabase database, there might be a need to reconfigure or verify the project settings, especially the webhook setup. Please ensure that the webhook pointing to the edge function add-new-email is correctly set up with the correct Authorization: Bearer ${anon public key} header.

  4. Supabase Edge Function Deployment Issues: If there was an issue during the deployment of the edge function (supabase functions deploy add-new-email), it might not be running as expected. Please check the deployment logs for any errors and redeploy if necessary.

  5. External Factors: The "Failed to fetch" error could also be due to external factors such as PostHog service downtime or rate limiting. Please check the status of the PostHog service and ensure that you're not hitting any rate limits.

If none of the above solutions work, could you please provide more details about the error? Specifically, it would be helpful to know the exact error message, network conditions, and the state of the Supabase and PostHog configurations post-database reset. This additional information will help us better understand the issue and provide a more accurate solution.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Mar 08 '24 07:03 dosubot[bot]

image image no change supabase/config.toml but : can not create user image

caihexin avatar Mar 08 '24 08:03 caihexin

Can you @dosu-bot. provide me with a create user SQL directly so that I can create an account to log in to Quivr ,Thank

caihexin avatar Mar 08 '24 08:03 caihexin

Based on the structure of the "auth"."users" table in the Supabase database for Quivr, you can use the following SQL command to create a new user:

INSERT INTO "auth"."users" (
    "id", 
    "email", 
    "encrypted_password", 
    "created_at", 
    "updated_at"
) 
VALUES (
    'new_user_id', 
    '[email protected]', 
    'encrypted_password_here', 
    CURRENT_TIMESTAMP, 
    CURRENT_TIMESTAMP
);

Please replace 'new_user_id', '[email protected]', and 'encrypted_password_here' with your desired user ID, email, and encrypted password respectively.

Note that the encrypted_password should be a hashed version of the password. You can use a function like crypt('password', gen_salt('bf')) to generate this, replacing 'password' with the actual password.

So the final command would look like this:

INSERT INTO "auth"."users" (
    "id", 
    "email", 
    "encrypted_password", 
    "created_at", 
    "updated_at"
) 
VALUES (
    'new_user_id', 
    '[email protected]', 
    crypt('password', gen_salt('bf')), 
    CURRENT_TIMESTAMP, 
    CURRENT_TIMESTAMP
);

Please be aware that this is a direct manipulation of the database and should be done with caution. Always ensure to backup your data before performing such operations.

For more information, you can refer to the supabase/seed.sql file in the Quivr repository.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Mar 08 '24 09:03 dosubot[bot]

image [email protected] What is the password?admin无法登录

caihexin avatar Mar 08 '24 09:03 caihexin

edit config.toml in studio section change api_url.

[studio]
enabled = true
# Port to use for Supabase Studio.
port = 54323
# External URL of the API server that frontend connects to.
api_url = "http://10.33.1.37" # Change your docker host IP
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
openai_api_key = "env(OPENAI_API_KEY)"

neozhu avatar Mar 08 '24 11:03 neozhu

worker | [2024-03-10 09:20:00,001: INFO/MainProcess] Task celery_worker.process_integration_brain_sync[f124eafd-6306-4efa-8ece-27457bced09a] received worker | [2024-03-10 09:20:00,031: INFO/ForkPoolWorker-58] HTTP Request: GET http://192.168.12.253:54321/rest/v1/integrations_user?select=%2A%2C%20integrations%20%28%29&integrations.integration_name=eq.notion "HTTP/1.1 200 OK" worker | [2024-03-10 09:20:00,047: ERROR/ForkPoolWorker-58] Task celery_worker.process_integration_brain_sync[f124eafd-6306-4efa-8ece-27457bced09a] raised unexpected: TypeError("'NoneType' object is not iterable")

@neozhu , studio app create user success,but quivr app cannot login .

caihexin avatar Mar 11 '24 03:03 caihexin

edit config.toml in studio section change api_url.

[studio]
enabled = true
# Port to use for Supabase Studio.
port = 54323
# External URL of the API server that frontend connects to.
api_url = "http://10.33.1.37" # Change your docker host IP
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
openai_api_key = "env(OPENAI_API_KEY)"

I also encountered this problem, and I solved it in this way. Thank you very much

xinsonggaodragonplus avatar Apr 11 '24 10:04 xinsonggaodragonplus