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

223
Visualizações
Expected value found [object, Object] Query Params

I don't get it, I sent in the right input type here:

Caller from JS code:

export interface FilterInput {
    limit?: number;
}

const filter: FilterInput = { limit: 1 };
const query = {
    query: `query { 
        companies(filter: ${filter}) {
            list {
                name
            }
        }
    }`,
};
const response = await sendQuery(query);
        

GraphQL Schema:

companies(filter: FilterInput): Companies

input FilterInput {
  limit: Int
}

Error: Expected value of type "FilterInput", found [object, Object].

When I try this out in graphiql in the browser, it works fine:

query {
    companies(filter: { limit: 6 }) {
        list {
            name
        }
    }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Using a js object in a template string directly resolves to [object Object] i.e. ${filter} resolves to precisely [object Object] hence the error.

To solve it you can use JSON.stringify(filter). Here is the string in the same format as before but with the fix:

`query { 
    companies(filter: ${JSON.stringify(filter)}) {
        list {
            name
        }
    }
}`
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