Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
NHOST TypeError: (intermediate value) is not a function

The following code from NHOST (https://docs.nhost.io/get-started/quick-start/javascript-client):

import { NhostClient } from '@nhost/nhost-js'

const nhost = new NhostClient({
  backendUrl: 'https://[app-subdomain].nhost.run'
})(async () => {
  // nhost.graphql.request returns a promise, so we use await here
  const todos = await nhost.graphql.request(`
    query {
      todos {
        id
        created_at
        name
        is_completed
      }
    }
  `)

  // Print todos to console
  console.log(JSON.stringify(todos.data, null, 2))
})()

is giving me an error in the terminal:

})(async () => {
  ^

TypeError: (intermediate value) is not a function
    at file:///Users/User/Documents/nhost-todos/index.js:5:3
    at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

It's supposed to return:

null

after running node index.js.

Any help would be much appreciated. These are all relatively new concepts for me.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can do this:

import { NhostClient } from '@nhost/nhost-js';

const nhost = new NhostClient({
  backendUrl: '',
});

const request = async () => {
  // nhost.graphql.request returns a promise, so we use await here
  const todos = await nhost.graphql.request(`
      query {
        todos {
          id
          created_at
          name
          is_completed
        }
      }
    `);

  // Print todos to console
  console.log(JSON.stringify(todos.data, null, 2));
};

request();
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda