f / graphql.js

A Simple and Isomorphic GraphQL Client for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: query.trim is not a function

komyg opened this issue · comments

Hi,

I am trying to use graphql.js inside the Google Cloud Functions to query my database through a Graphql interface.

However when I try to set the URL, I get this error:

textPayload: "TypeError: query.trim is not a function
    at Object.helper (/srv/node_modules/graphql.js/graphql.js:425:80)
    at GraphQLClient.that.(anonymous function) [as query] (/srv/node_modules/graphql.js/graphql.js:442:23)
    at listAggregators (/srv/lib/intents/location-permission.js:17:54)

Here is my code:

const graphql = require('graphql.js');

function listAggregators(conv: DialogflowConversation) {
  const graph = graphql('https://graphql.staging.mygraphq.com/graphql');
 // [...]
}

Should I set some extra parameters here?

Note: I am using typescript, instead of javascript. Maybe there is some compiler option that I should set, because I also get a compile error when I try to use import instead of require in import graphql from 'graphql.js';

Thanks,
Komyg

Did u get any lead regarding this query, Iam also facing same issue