influxdata / influxdb-client-ruby

InfluxDB 2.0 Ruby Client

Home Page:https://influxdata.github.io/influxdb-client-ruby/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ping api always return failure

piya23300 opened this issue · comments

commented

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

For Influxdb could 2.0

run check health

client = InfluxDB2::Client.new(
  ENV['INFLUXDB_URL'], # influxdb cloud url
  ENV['INFLUXDB_TOKEN'],
  use_ssl: true
)
client.health
# => #<InfluxDB2::HealthCheck:0x0000563320a1c2b0 @name="influxdb", @status="fail", @message="434: unexpected token at '<!doctype html><html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>InfluxDB 2.0</title><base href=\"/\"><script>(function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-NXMTGSW');</script><link rel=\"shortcut icon\" href=\"/favicon.ico\"></head><body><div id=\"react-root\" data-basepath=\"\"></div><noscript><iframe src=\"https://www.googletagmanager.com/ns.html?id=GTM-NXMTGSW\" height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe></noscript><script src=\"/static/6a0c379661.js\"></script></body></html>]'">
client.health.status
# => "fail"

For InfluxDB OSS, it works correctly.

Note. For the same setting, writing API still works for both (InfluxDB OSS and Cloud).

Expected behavior:
Describe what you expected to happen.

For Influxdb could 2.0
client.health.status should return pass

Actual behavior:
Describe What actually happened.

For Influxdb could 2.0
client.health.status always return fail

Specifications:

  • Client Version: influxdb-client (1.9.0)
  • InfluxDB Version: 2.0
  • Platform: Ruby on Rails

Hi @piya23300,

Thanks for using our client.

It is caused by influxdata/influxdb#19357.

As a workaround you could use something like:

healthy = begin
            client.create_query_api.query(query: "buckets()", org: "my-org")
            true
          rescue StandardError => _
            false
          end

puts "Healthy: #{healthy}"

Regards

commented

@bednar thank you.