jars
05/26/2020, 12:44 AMquery {
  project(limit: 10, offset: 0) {
    name
  }
}
My response:
{
  "errors": [
    {
      "message": "Response not successful: Received status code 400",
      "locations": [],
      "path": [
        "project"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "name": "ServerError",
          "response": {
            "size": 0,
            "timeout": 0
          },
          "statusCode": 400,
          "result": {
            "errors": [
              {
                "extensions": {
                  "path": "$.selectionSet.project",
                  "code": "validation-failed"
                },
                "message": "field \"project\" not found in type: 'query_root'"
              }
            ]
          }
        }
      }
    }
  ],
  "data": null,
  "extensions": {
    "tracing": {
      "version": 1,
      "startTime": "2020-05-26T00:41:36.814Z",
      "endTime": "2020-05-26T00:41:36.819Z",
      "duration": 4909820,
      "execution": {
        "resolvers": [
          {
            "path": [
              "project"
            ],
            "parentType": "Query",
            "fieldName": "project",
            "returnType": "[project!]!",
            "startOffset": 88849,
            "duration": 4807789
          }
        ]
      }
    }
  }
}
I've tried with both JavaScript (using apollo-link) and also CLI using curl. Both give same result.nicholas
jars
05/26/2020, 12:48 AM/graphql and also adding graphql/alpha after inspecting network requests in the Interactive API dashboard. But, none seem to work:
const link = new HttpLink({
  uri,
  fetch,
  headers: { authorization: `Bearer ${PREFECT_CLOUD_TOKEN}` }
});
And like this with curl:
curl -X POST -H "Content-Type: application/json" -H "authorization: Bearer <token here>" -d @payload.json <https://api.prefect.io>jars
05/26/2020, 12:51 AMjars
05/26/2020, 12:51 AMnicholas
Authorization instead of authorization against <https://api.prefect.io/graphql>?nicholas
jars
05/26/2020, 12:58 AMjars
05/26/2020, 1:00 AMnicholas
jars
05/26/2020, 1:02 AMconst { execute, makePromise } = require('apollo-link');
const { HttpLink }             = require('apollo-link-http');
const gql                      = require('graphql-tag');
const fs                       = require('fs');
const fetch                    = require('node-fetch');
require('dotenv').config();
const uri = '<https://api.prefect.io/graphql>';
const { PREFECT_CLOUD_TOKEN } = process.env;
const link = new HttpLink({
  uri,
  fetch,
  headers: { Authorization: `Bearer ${PREFECT_CLOUD_TOKEN}` }
});
const query = 'query { project(limit: 10, offset: 0) { name } }';
const operation = { query: gql(query), variables: {} };
(async () => {
  try {
    const data = await makePromise(execute(link, operation));
    console.log(JSON.stringify(data));
  }
  catch (err) {
    console.log('failure');
    console.log(err);
  }
})();jars
05/26/2020, 1:06 AMmkdir api_issue_may_25
cd api_issue_may_25
npm init -y
npm i --save apollo-link apollo-link-http graphql-tag node-fetch
<dump above file into index.js in this directory>
PREFECT_CLOUD_TOKEN=<token here> node index.jsnicholas
jars
05/26/2020, 1:16 AMjars
05/26/2020, 1:16 AMnicholas
TENANT-scoped token for that operationjars
05/26/2020, 1:18 AMnicholas
jars
05/26/2020, 1:19 AMjars
05/26/2020, 1:21 AMnicholas
jars
05/26/2020, 1:21 AMnicholas
nicholas
jars
05/27/2020, 11:29 PMquery {
  project(order_by: { name: asc }) {
    name
  }
}
This is straight out of the Prefect docs.
I am getting 403 Forbidden errors... But If I remove the order by, it returns successfully:
query {
  project {
    name
  }
}jars
05/27/2020, 11:30 PMnicholas
jars
05/28/2020, 6:15 PMjars
05/28/2020, 6:15 PMjars
05/28/2020, 6:18 PMnicholas
jars
05/28/2020, 6:20 PM