Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda