dify icon indicating copy to clipboard operation
dify copied to clipboard

HTTP_REQUEST_NODE_SSL_VERIFY=False in api and web, but still getting an SSL error when adding the model. The HTTP error is: UnboundLocalError: local variable 'content' referenced before assignment

Open peterliang5678 opened this issue 10 months ago • 3 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.1

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

HTTP_REQUEST_NODE_SSL_VERIFY=False in api and web, but still getting an SSL error when adding the model. The HTTP error is: UnboundLocalError: local variable 'content' referenced before assignment

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

peterliang5678 avatar Mar 19 '25 07:03 peterliang5678

The error message "UnboundLocalError: local variable 'content' referenced before assignment" suggests that the variable content is being used before it has been assigned a value. This can occur if there is a conditional block where content is only assigned under certain conditions, and those conditions are not met.

To address this issue, you should:

  1. Check the Code Logic: Look for the function or section of the code where content is defined and ensure that it is assigned a value in all possible execution paths. This might involve initializing content with a default value before any conditional logic.

  2. Review SSL Configuration: Although you have set HTTP_REQUEST_NODE_SSL_VERIFY=False, ensure that this configuration is correctly applied in the context where the error occurs. Double-check that the configuration is being read and applied as expected.

  3. Debugging: Add logging or print statements before the line where content is used to verify whether it has been assigned a value. This can help identify the specific conditions under which the error occurs.

Unfortunately, I couldn't find specific information about where the content variable is defined or used in the Dify codebase. You might need to search through the code to locate the relevant section. If the issue persists, consider reviewing recent changes or commits that might have affected this part of the code.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 19 '25 07:03 dosubot[bot]

You have an issue with the Open AI Compable Model Provider: Image

And expect an ENV variable named HTTP_REQUEST_NODE_SSL_VERIFY to be the issue. Here's the node that variable is meant for: Image

DavideDelbianco avatar Mar 24 '25 08:03 DavideDelbianco

Hi, @peterliang5678. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • The issue involves an SSL error and an UnboundLocalError related to the 'content' variable when adding a model in a self-hosted Dify environment.
  • You reported setting HTTP_REQUEST_NODE_SSL_VERIFY=False but still encountering the error.
  • I suggested checking the code logic for 'content' assignment and verifying SSL configuration.
  • @DavideDelbianco mentioned a potential misunderstanding regarding the environment variable, suggesting it might relate to a specific node in the Open AI Compatible Model Provider setup.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the Dify repository. If it is, you can keep the discussion open by commenting on the issue.
  • Otherwise, the issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Apr 24 '25 16:04 dosubot[bot]