langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
36.4k stars 4.92k forks source link

Invitation links to the same user are not generated correctly after the second time. #5391

Open kurehajime opened 2 weeks ago

kurehajime commented 2 weeks ago

Self Checks

Dify version

0.6.11

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. invite users. But forget to save the invitation link.
  2. invite the user again. The invitation link is not generated properly and the URL of the login page is generated.
  3. delete the user
  4. invite the user again, but the invitation link is not created correctly
名称未設定

Invitation links to other users are correctly generated. This problem is serious in environments where a mail server is not provided.

✔️ Expected Behavior

❌ Actual Behavior

dosubot[bot] commented 2 weeks ago

@kurehajime Hello! I'm here to help you with bugs, questions, and becoming a contributor. Let me know how I can assist you!

To resolve the issue of invitation links not being generated correctly in Dify version 0.6.11 when re-inviting users or inviting deleted users in a self-hosted Docker environment, you should check and correctly configure the following environment variables:

  1. CONSOLE_API_URL: Ensure this is set to the correct URL of your console API backend.
  2. CONSOLE_WEB_URL: Ensure this is set to the correct URL of your console web frontend.

Example configuration:

CONSOLE_API_URL=https://api.console.dify.ai
CONSOLE_WEB_URL=https://console.dify.ai

Additionally, ensure that other related environment variables are correctly set, as they might also impact the generation of invitation links:

  1. SERVICE_API_URL: This should be set to the URL of your service API backend.
  2. APP_API_URL: This should be set to the URL of your WebApp API backend.
  3. APP_WEB_URL: This should be set to the URL of your WebApp frontend.

Example configuration:

SERVICE_API_URL=https://api.dify.ai
APP_API_URL=https://app.dify.ai
APP_WEB_URL=https://app.dify.ai

Make sure these URLs are accessible and correctly point to your Dify instance's API and web frontend [1][2].

If the issue persists, you may need to clear any cache or database entries related to user invitations. Here are the steps:

  1. Access the Docker Container:

    docker exec -it <container_name> /bin/bash
  2. Access the Database:

    psql -U <username> -d <database_name>
  3. Clear Invitation Entries:

    DELETE FROM account WHERE <condition>;
    DELETE FROM tenant_account_role WHERE <condition>;
  4. Clear Cache:

    redis-cli DEL member_invite:token:<token>
    redis-cli DEL member_invite_token:<workspace_id>, <email_hash>:<token>
  5. Restart the Docker Container:

    docker restart <container_name>

By following these steps, you can ensure that invitation links are generated correctly for re-invited or deleted users [3][4].

To continue talking to Dosu, mention @dosu.

kurehajime commented 2 weeks ago

Thank you dosubot 👍 Deleting the data in the accounts table correctly created the invitation link.

I have found a workaround, but it would be a better product if there was also a way to resolve this from the GUI. I don't know if data integrity can be maintained by manual deletion.