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

152
Visualizações
Graphql is returning the promise and not my DynamoDB data

I am using a Graphql API to access my DynamoDB database. I am then trying to render the list of users in my app. According to the docs I should use:

import * as queries from './graphql/queries';

const users = await API.graphql({ query: queries.listUsers });
console.log(users);

However, I get an error regarding the await. So I removed the await key word, but const users = API.graphql({ query: queries.listUsers }); returns the promise. This is the response:

Promise {
  "_U": 0,
  "_V": 0,
  "_W": null,
  "_X": null,
}

I put my code into an async function and used the await keyword and still only got the promise. Is there a way to simply call the query and without the await and get the correct data instead of the promise? I have also been trying to use the GraphQLResult to get the actual result, but that isn't working, I am either getting errors or I am still getting the promise.

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

0

using try catch block to handle error of the await await return the promise result but after remove the await, it just return the promise, you should use then catch to get the result

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