Skip to content

TypeError: query.trim is not a function #39

Description

@komyg

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions