Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncated output or hanging response in API call without Content-Length #524

Open
ajdaniel opened this issue Aug 17, 2020 · 0 comments
Open

Comments

@ajdaniel
Copy link

Expected Behavior

When querying an influxDB that seemingly doesn't respond with a Content-Length header, I should still get the complete response.

Actual Behavior

With NodeJS 12, the socket closes too soon and the data is incomplete
With NodeJS 14, the socket hangs forever

Steps/Code to Reproduce the Problem

I'm running a standard query:

const Influx = require('influx');
const influx = new Influx.InfluxDB({
  host: 'localhost',
  port: 8086,
  username: 'my_user',
  password: 'my_pass',
});

try {
    const results = await influx.query(
        `SELECT mean("cpu") AS "CPU" FROM "serverstat" WHERE time >= now() - 1d AND "serverid" = '${server_id}' GROUP BY time(1m), "serverid" fill(0)`,
      {
        database: 'serverdb',
      }
    );
    console.log(results);
  } catch (e) {
    console.error('Error fetching server compute', e);
    return res.status(500).send(e.message);
  }

error usually comes in the form of a JSON parse error as the body is not complete.

Specifications

  • Version: 5.6.3
  • Platform: Mac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants