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

Closed
opened 2026-02-21 18:05:03 -05:00 by yindo · 4 comments
Owner

Originally created by @kurehajime on GitHub (Jun 19, 2024).

Originally assigned to: @crazywoola on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

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

  • Invitation links can be generated as many times as required.
  • Invitation links are generated correctly when re-inviting a deleted user.

Actual Behavior

  • Invitation links are not generated correctly the second time or later
  • Invitation links are not generated correctly for users who have been deleted once.
Originally created by @kurehajime on GitHub (Jun 19, 2024). Originally assigned to: @crazywoola on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Please do not modify this template :) and fill in all the required fields. ### 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 <img width="426" alt="名称未設定" src="https://github.com/langgenius/dify/assets/4569916/03090377-6f7b-48fc-84e5-d0f2fc3aea33"> Invitation links to other users are correctly generated. This problem is serious in environments where a mail server is not provided. ### ✔️ Expected Behavior - Invitation links can be generated as many times as required. - Invitation links are generated correctly when re-inviting a deleted user. ### ❌ Actual Behavior - Invitation links are not generated correctly the second time or later - Invitation links are not generated correctly for users who have been deleted once.
yindo added the 🐞 bug label 2026-02-21 18:05:03 -05:00
yindo closed this issue 2026-02-21 18:05:03 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 19, 2024):

@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.

@dosubot[bot] commented on GitHub (Jun 19, 2024): <!-- Greeting --> @kurehajime Hello! I'm here to help you with bugs, questions, and becoming a contributor. Let me know how I can assist you! <!-- Answer --> 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: ```env 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: 3. **SERVICE_API_URL**: This should be set to the URL of your service API backend. 4. **APP_API_URL**: This should be set to the URL of your WebApp API backend. 5. **APP_WEB_URL**: This should be set to the URL of your WebApp frontend. Example configuration: ```env 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 <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/getting-started/install-self-hosted/environments.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/environments.md)</sup>. 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**: ```sh docker exec -it <container_name> /bin/bash ``` 2. **Access the Database**: ```sh psql -U <username> -d <database_name> ``` 3. **Clear Invitation Entries**: ```sql DELETE FROM account WHERE <condition>; DELETE FROM tenant_account_role WHERE <condition>; ``` 4. **Clear Cache**: ```sh redis-cli DEL member_invite:token:<token> redis-cli DEL member_invite_token:<workspace_id>, <email_hash>:<token> ``` 5. **Restart the Docker Container**: ```sh docker restart <container_name> ``` By following these steps, you can ensure that invitation links are generated correctly for re-invited or deleted users <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/controllers/console/workspace/members.py)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/services/account_service.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@kurehajime commented on GitHub (Jun 19, 2024):

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.

@kurehajime commented on GitHub (Jun 19, 2024): 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.
Author
Owner

@yaohongfenglove commented on GitHub (Jul 10, 2024):

Has this problem not been solved yet? The issue with version 0.6.13 still recurs

@yaohongfenglove commented on GitHub (Jul 10, 2024): Has this problem not been solved yet? The issue with version 0.6.13 still recurs
Author
Owner

@prd-tien-ngo commented on GitHub (Jul 17, 2024):

Hi there!

I am deploying 0.6.14 to kubernetes cluster. Everythings seems good exception send-mail function.

I am using resend mail type by setting below variables for api pod

    - name: MAIL_TYPE
      value: "resend"
    - name: RESEND_API_KEY
      value: "**********"
    - name: RESEND_API_URL
      value: "https://api.resend.com"

Whenever I creating a new user, no invitation link appears

image

and the invite-email call is timeout with http 504 code

image

And the following logs appeared in the api pod (I enabled debug logging)

2024-07-17 06:49:30,598.598 DEBUG [Dummy-13] [functional.py:335] -
def document_indexing_sync_task(dataset_id, document_id):
    return 1

2024-07-17 06:49:30,600.600 DEBUG [Dummy-13] [functional.py:335] -
def clean_notion_document_task(document_ids, dataset_id):
    return 1

2024-07-17 06:49:30,600.600 DEBUG [Dummy-13] [functional.py:335] -
def batch_import_annotations_task(job_id, content_list, app_id, tenant_id, user_id):
    return 1

2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] -
def add_document_to_index_task(dataset_document_id):
    return 1

2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] -
def clean_dataset_task(dataset_id, tenant_id, indexing_technique, index_struct, collection_binding_id, doc_form):
    return 1

2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] -
def retry_document_indexing_task(dataset_id, document_ids):
    return 1

2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] -
def document_indexing_task(dataset_id, document_ids):
    return 1

2024-07-17 06:49:30,602.602 DEBUG [Dummy-13] [functional.py:335] -
def accumulate(self, *args, **kwargs):
    return 1

2024-07-17 06:49:30,602.602 DEBUG [Dummy-13] [functional.py:335] -
def process_trace_tasks(tasks_data):
    return 1

2024-07-17 06:49:30,602.602 DEBUG [Dummy-13] [functional.py:335] -
def update_annotation_to_index_task(annotation_id, question, tenant_id, app_id, collection_binding_id):
    return 1

2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] -
def unlock_chord(self, group_id, callback, interval=0, max_retries=1, result=2, Result=3, GroupResult=4, result_from_tuple=5, **kwargs):
    return 1

2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] -
def xmap(task, it):
    return 1

2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] -
def sync_website_document_indexing_task(dataset_id, document_id):
    return 1

2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] -
def delete_annotation_index_task(annotation_id, app_id, tenant_id, collection_binding_id):
    return 1

2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] -
def remove_document_from_index_task(document_id):
    return 1

2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] -
def deal_dataset_vector_index_task(dataset_id, action):
    return 1

2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] -
def xstarmap(task, it):
    return 1

2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] -
def document_indexing_update_task(dataset_id, document_id):
    return 1

2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] -
def batch_create_segment_to_index_task(job_id, content, dataset_id, document_id, tenant_id, user_id):
    return 1

2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] -
def chunks(task, it, n):
    return 1

2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] -
def clean_document_task(document_id, dataset_id, doc_form, file_id):
    return 1

2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] -
def send_invite_member_mail_task(language, to, token, inviter_name, workspace_name):
    return 1

2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] -
def group(self, tasks, result, group_id, partial_args, add_to_parent=0):
    return 1

2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] -
def delete_segment_from_index_task(segment_id, index_node_id, dataset_id, document_id):
    return 1

2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] -
def chain(*args, **kwargs):
    return 1

2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] -
def disable_annotation_reply_task(job_id, app_id, tenant_id):
    return 1

2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] -
def duplicate_document_indexing_task(dataset_id, document_ids):
    return 1

2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] -
def chord(self, header, body, partial_args=0, interval=1, countdown=2, max_retries=3, eager=4, **kwargs):
    return 1

2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] -
def enable_segment_to_index_task(segment_id):
    return 1

2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] -
def backend_cleanup():
    return 1

2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] -
def add_annotation_to_index_task(annotation_id, question, tenant_id, app_id, collection_binding_id):
    return 1

2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] -
def send_reset_password_mail_task(language, to, token):
    return 1

2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] -
def disable_segment_from_index_task(segment_id):
    return 1

2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] -
def enable_annotation_reply_task(job_id, app_id, user_id, tenant_id, score_threshold, embedding_provider_name, embedding_model_name):
    return 1

2024-07-17 06:49:30,608.608 DEBUG [Dummy-13] [functional.py:335] -
def recover_document_indexing_task(dataset_id, document_id):
    return 1

2024-07-17 06:49:30,608.608 DEBUG [Dummy-13] [functional.py:335] -
def remove_app_and_related_data_task(self, app_id):
    return 1

Could anyone advise how to fix the issue? is there a way that I can bypass the invitation email-sending function? Only invitation link is good enough for my case.

Thanks!

@prd-tien-ngo commented on GitHub (Jul 17, 2024): Hi there! I am deploying 0.6.14 to kubernetes cluster. Everythings seems good exception send-mail function. I am using `resend` mail type by setting below variables for api pod ``` - name: MAIL_TYPE value: "resend" - name: RESEND_API_KEY value: "**********" - name: RESEND_API_URL value: "https://api.resend.com" ``` Whenever I creating a new user, no invitation link appears <img width="959" alt="image" src="https://github.com/user-attachments/assets/740f4c34-de87-4f41-9433-656933a6832e"> and the `invite-email` call is timeout with http 504 code <img width="817" alt="image" src="https://github.com/user-attachments/assets/b1ae6002-daf5-4c17-b944-465e9e87fc2f"> And the following logs appeared in the api pod (I enabled debug logging) ``` 2024-07-17 06:49:30,598.598 DEBUG [Dummy-13] [functional.py:335] - def document_indexing_sync_task(dataset_id, document_id): return 1 2024-07-17 06:49:30,600.600 DEBUG [Dummy-13] [functional.py:335] - def clean_notion_document_task(document_ids, dataset_id): return 1 2024-07-17 06:49:30,600.600 DEBUG [Dummy-13] [functional.py:335] - def batch_import_annotations_task(job_id, content_list, app_id, tenant_id, user_id): return 1 2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] - def add_document_to_index_task(dataset_document_id): return 1 2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] - def clean_dataset_task(dataset_id, tenant_id, indexing_technique, index_struct, collection_binding_id, doc_form): return 1 2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] - def retry_document_indexing_task(dataset_id, document_ids): return 1 2024-07-17 06:49:30,601.601 DEBUG [Dummy-13] [functional.py:335] - def document_indexing_task(dataset_id, document_ids): return 1 2024-07-17 06:49:30,602.602 DEBUG [Dummy-13] [functional.py:335] - def accumulate(self, *args, **kwargs): return 1 2024-07-17 06:49:30,602.602 DEBUG [Dummy-13] [functional.py:335] - def process_trace_tasks(tasks_data): return 1 2024-07-17 06:49:30,602.602 DEBUG [Dummy-13] [functional.py:335] - def update_annotation_to_index_task(annotation_id, question, tenant_id, app_id, collection_binding_id): return 1 2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] - def unlock_chord(self, group_id, callback, interval=0, max_retries=1, result=2, Result=3, GroupResult=4, result_from_tuple=5, **kwargs): return 1 2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] - def xmap(task, it): return 1 2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] - def sync_website_document_indexing_task(dataset_id, document_id): return 1 2024-07-17 06:49:30,603.603 DEBUG [Dummy-13] [functional.py:335] - def delete_annotation_index_task(annotation_id, app_id, tenant_id, collection_binding_id): return 1 2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] - def remove_document_from_index_task(document_id): return 1 2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] - def deal_dataset_vector_index_task(dataset_id, action): return 1 2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] - def xstarmap(task, it): return 1 2024-07-17 06:49:30,604.604 DEBUG [Dummy-13] [functional.py:335] - def document_indexing_update_task(dataset_id, document_id): return 1 2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] - def batch_create_segment_to_index_task(job_id, content, dataset_id, document_id, tenant_id, user_id): return 1 2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] - def chunks(task, it, n): return 1 2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] - def clean_document_task(document_id, dataset_id, doc_form, file_id): return 1 2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] - def send_invite_member_mail_task(language, to, token, inviter_name, workspace_name): return 1 2024-07-17 06:49:30,605.605 DEBUG [Dummy-13] [functional.py:335] - def group(self, tasks, result, group_id, partial_args, add_to_parent=0): return 1 2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] - def delete_segment_from_index_task(segment_id, index_node_id, dataset_id, document_id): return 1 2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] - def chain(*args, **kwargs): return 1 2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] - def disable_annotation_reply_task(job_id, app_id, tenant_id): return 1 2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] - def duplicate_document_indexing_task(dataset_id, document_ids): return 1 2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] - def chord(self, header, body, partial_args=0, interval=1, countdown=2, max_retries=3, eager=4, **kwargs): return 1 2024-07-17 06:49:30,606.606 DEBUG [Dummy-13] [functional.py:335] - def enable_segment_to_index_task(segment_id): return 1 2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] - def backend_cleanup(): return 1 2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] - def add_annotation_to_index_task(annotation_id, question, tenant_id, app_id, collection_binding_id): return 1 2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] - def send_reset_password_mail_task(language, to, token): return 1 2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] - def disable_segment_from_index_task(segment_id): return 1 2024-07-17 06:49:30,607.607 DEBUG [Dummy-13] [functional.py:335] - def enable_annotation_reply_task(job_id, app_id, user_id, tenant_id, score_threshold, embedding_provider_name, embedding_model_name): return 1 2024-07-17 06:49:30,608.608 DEBUG [Dummy-13] [functional.py:335] - def recover_document_indexing_task(dataset_id, document_id): return 1 2024-07-17 06:49:30,608.608 DEBUG [Dummy-13] [functional.py:335] - def remove_app_and_related_data_task(self, app_id): return 1 ``` Could anyone advise how to fix the issue? is there a way that I can bypass the invitation email-sending function? Only invitation link is good enough for my case. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4176