<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GraphQL from Serverless Issue in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/633006#M53207</link>
    <description>&lt;P&gt;Thank you &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt; !&lt;/P&gt;</description>
    <pubDate>Sat, 14 May 2022 13:14:46 GMT</pubDate>
    <dc:creator>Kevin-C</dc:creator>
    <dc:date>2022-05-14T13:14:46Z</dc:date>
    <item>
      <title>GraphQL from Serverless Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/628851#M53002</link>
      <description>&lt;P&gt;Hey Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm attempting to hit the GQL endpoint from serverless function. When requested I get the response:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
    "response": {
        "statObjs": {
            "message": "Request failed with status code 400",
            "name": "Error",
            "stack": "Error: Request failed with status code 400\n    at createError (/opt/nodejs/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/opt/nodejs/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/opt/nodejs/node_modules/axios/lib/adapters/http.js:236:11)\n    at IncomingMessage.emit (events.js:326:22)\n    at endReadableNT (_stream_readable.js:1241:12)\n    at processTicksAndRejections (internal/process/task_queues.js:84:21)",
            "config": {
                "url": "https://api.hubapi.com/collector/graphql?hapikey=XXXXXXXXXXXXXXXXX",
                "method": "post",
                "data": "{\"header\":{\"Content-Type\":\"application/json\",\"Accept\":\"application/json, text/plain, */*\"},\"body\":\"\\\"{\\\\n        \\\\\\\"operationName\\\\\\\": \\\\\\\"myquery\\\\\\\",\\\\n        \\\\\\\"query\\\\\\\": \\\\\\\"query myquery($contactid: String!,$id: String!,$reporttype: String!) { CRM {contact(uniqueIdentifier: $id, uniqueIdentifierValue:$contactid) { name associations { p_repoted_stat_collection__reported_stat_to_contact(limit: 200, filter: {recordtypename__eq: $reporttype})  {total items {report_week}} } }}}\\\\\\\",\\\\n        \\\\\\\"variables\\\\\\\": {\\\\\\\"contactid\\\\\\\": \\\\\\\"1398551\\\\\\\", \\\\\\\"id\\\\\\\": \\\\\\\"id\\\\\\\", \\\\\\\"reporttype\\\\\\\": \\\\\\\"weekly\\\\\\\"}\\\\n      }\\\"\"}",
                "headers": {
                    "Accept": "application/json, text/plain, */*",
                    "Content-Type": "application/json;charset=utf-8",
                    "User-Agent": "axios/0.19.2",
                    "Content-Length": 631
                },
                "transformRequest": [
                    null
                ],
                "transformResponse": [
                    null
                ],
                "timeout": 0,
                "xsrfCookieName": "XSRF-TOKEN",
                "xsrfHeaderName": "X-XSRF-TOKEN",
                "maxContentLength": -1
            }
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Integrations Call Log:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
  "status": "error",
  "message": "Invalid input JSON on line 1, column 631: Cannot build GraphQLQuery, some of required attributes are not set [query]",
  "correlationId": "XXXXXXXXXX"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The query:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
        "operationName": "myquery",
        "query": "query myquery($contactid: String!,$id: String!,$reporttype: String!) { CRM {contact(uniqueIdentifier: $id, uniqueIdentifierValue:$contactid) { name associations { p_repoted_stat_collection__reported_stat_to_contact(limit: 200, filter: {recordtypename__eq: $reporttype})  {total items {report_week}} } }}}",
        "variables": {"contactid": "1398551", "id": "id", "reporttype": "weekly"}
      }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using this query with postman I do get the expected results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't quite figure out whats causing the query not to be set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 17:22:55 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/628851#M53002</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2022-05-07T17:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: GraphQL from Serverless Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/628856#M53003</link>
      <description>&lt;P&gt;I think I might be passing the payload in incorrectly? But thats just an assumption based on the response not find the query.&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 17:47:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/628856#M53003</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2022-05-07T17:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: GraphQL from Serverless Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/629199#M53022</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/73772"&gt;@Kevin-C&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Is the error caused because HubSpot can not find the query? Or is it caused because the query contains a param that is not passed correctly?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If it is the first, just to have the code identical to the docs, could you add a space after 'myquery':&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
        "operationName": "myquery",
        "query": "query myquery ($contactid: String!,$id: String!,$reporttype: String!) { CRM {contact(uniqueIdentifier: $id, uniqueIdentifierValue:$contactid) { name associations { p_repoted_stat_collection__reported_stat_to_contact(limit: 200, filter: {recordtypename__eq: $reporttype})  {total items {report_week}} } }}}",
        "variables": {"contactid": "1398551", "id": "id", "reporttype": "weekly"}
      }&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;If it is the second, could you try, for the sake of testing, to only use non-required params for your query? So use &lt;STRONG&gt;String&amp;nbsp;&lt;/STRONG&gt;instead of&amp;nbsp;&lt;STRONG&gt;String!&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;I do not see anything wrong with your code.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 07:45:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/629199#M53022</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-05-09T07:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: GraphQL from Serverless Issue</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/633006#M53207</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt; !&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 13:14:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/GraphQL-from-Serverless-Issue/m-p/633006#M53207</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2022-05-14T13:14:46Z</dc:date>
    </item>
  </channel>
</rss>

