Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
Cannot get any response from Infux Query in Javascript?

I can write data to influx db but cannot read written data via flux query. I can read data with the same flux query from inlfuxdb data explorer.

async getLatestBlockData() {
    let response = '';
    const queryApi = this.influxDB.getQueryApi(this.org)
    //range start:0 returns the all data from the bucket
/*     const fluxQuery = `from(bucket:${this.bucket}) 
      |> range(start: 0) 
      |> filter(fn: (r) => r._measurement == "c_chain_blocks")`; */
    const fluxQuery = `from(bucket: ${this.bucket})
    |> range(start: 0, stop: now())
    |> filter(fn: (r) => r["_measurement"] == "c_chain_blocks")`;

     /*queryApi.queryRaw(fluxQuery)
      .then((result: any) => {
        console.log(result)
        response = result;
        console.log('\nQueryRaw SUCCESS')
      })
      .catch((error: any) => {
        console.error(error)
        response = error;
        console.log('\nQueryRaw ERROR')
      }) */

      queryApi.queryRows(fluxQuery, {
      next(row: string[], tableMeta: FluxTableMetaData) {
        const o = tableMeta.toObject(row)
        // console.log(JSON.stringify(o, null, 2))
        console.log(
          `${o._time} ${o._measurement} in '${o.location}' (${o.example}): ${o._field}=${o._value}`
        )
      },
      error(error: Error) {
        console.error(error)
        console.log('\nFinished ERROR')
      },
      complete() {
        console.log('\nFinished SUCCESS')
      },
    })  
    console.log(response)
  }

In both ways, I could not fetch data. Even in the debugger it did not enter any then and catch block inside.

Could you help me what is the problem?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!