Discourse AI Internal Server Error

I’m running Discourse via the self-hosting docker on a ubuntu VM. I’ve installed the Discourse AI plugin without issue, all of the settings appear on the admin panel, however when I attempt to use any AI services or test them on the admin panel I encounter these errors. Frankly I have no clue what’s going on here, I can ping both openAI’s api and google’s inside the docker with curl -I but the actual Discourse AI implementation seems to have some error that’s well beyond my paygrade of understanding.

The site runs through cloudflare zero trust if that makes any difference.

Timeout::Error (Timeout::Error)
lib/final_destination/resolver.rb:31:in `block in lookup'
lib/final_destination/resolver.rb:8:in `synchronize'
lib/final_destination/resolver.rb:8:in `lookup'
lib/final_destination/ssrf_detector.rb:128:in `lookup_ips'
lib/final_destination/ssrf_detector.rb:96:in `lookup_and_filter_ips'
lib/final_destination/http.rb:15:in `connect'
app/controllers/application_controller.rb:427:in `block in with_resolved_locale'
app/controllers/application_controller.rb:427:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:35:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:410:in `call'
lib/middleware/csp_script_nonce_injector.rb:12:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
lib/middleware/default_headers.rb:13:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/processing_request.rb:12:in `call'
lib/middleware/request_tracker.rb:385:in `call'

Edit:

Selecting the " Disable native tool support (use XML based tools) (optional) " checkbox with openai seems to now have the run test at a 50% success rate but does nothing for gemini. If anything I think this has made me more confused.

1 Like

Sorry for reclassifying this as support, but looking at the error there is a timeout resolving DNS inside your container.

This is a strong indicator that DNS is not configured properly on the host and/or is using a slow / sub-optimal resolver.

The particular error is not to do with cloudflare.

2 Likes

This def should’ve gone support first, brain is a bit fried from the last week of server setup and discourse setup, thanks!

Ultimately fixed, not sure what of the three changes I made did it. But for the benefit of anyone in the future.

  1. Changed DNS from google DNS to cloudflare DNS
  2. Increased Ubuntu VM allocated resources from 4c8t to 8c16t and 16gb to 32gb of ram
  3. Increased number of unicorns from 8 to 16
1 Like

This is most likely the case, Google DNS is great but maybe your droplet / VM / whatever was not routing to it properly.