OS edtion & grapQL Api definition

Hi,
I try to define a custom API from REST to Graph from open source tyk on Docker image it’s not an easier way.
I try to work with example in the doc here
I activate successfully the playground with many errors :
server can be reach
and

{
  "error": "Unexpected token < in JSON at position 0"
}

without playground, I tried to grab countries with this query :

query|without query key {
    countries {
        name
    }
}

result of the query is:

{
    "errors": [
        {
            "message": "type not defined: ",
            "path": [
                "query"
            ]
       }
   ]
}

Edit :
in my api config file have added in graphql key a schema key with value:
"type Query { \n countries: {\n countries: String\n}\n}

Error change to :

{
    "error": "there was a problem proxying the request"
}

and catch in docker log :

➜  tyk git:(main) ✗  time="May 21 14:47:28" level=error msg="Schema is not created" api_id=3 
api_name=Catalogue key="****cf22" mw=GraphQLMiddleware org_id=1 origin=172.18.0.1 
path="/catalogue/"

Thanks for your help.

Best,

Hi!

Any chance you can upload here your API definition so we can try it locally?

Thanks!

Yes:

{
    "name": "Catalogue",
    "slug": "catalogue",
    "api_id": "3",
    "org_id": "1",
    "auth_configs": {
        "authToken": {
            "auth_header_name": "x-tyk-authorization"
        }
    },
    "definition": {
        "location": "header",
        "key": "x-api-version"
    },
    "version_data": {
        "not_versioned": true,
        "versions": {
            "Default": {
                "name": "Default",
                "use_extended_paths": true
            }
        }
    },
    "custom_middleware": {
        "pre": [
            {
                "name": "getToken",
                "path": "./middleware/getToken.js",
                "require_session": false,
                "raw_body_only": false
            }
        ]
    },
    "proxy": {
        "listen_path": "/catalogue/",
        "target_url": "http://xxxx/api/rest/v1/products/",
        "strip_listen_path": true
    },
    "active": true,
    "graphql": {
        "playground": {
            "enabled": false,
            "path": ""
        },
        "enabled" : true,
        "schema": "type Query { \n countries: {\n countries: String\n}\n}",
        "last_schema_update": "2021-02-16T15:05:27.454+05:30",
        "engine": {
            "field_configs": [
                {
                    "type_name": "Query",
                    "field_name": "pet",
                    "disable_default_mapping": true,
                    "path": [
                        ""
                    ]
                },
                {
                    "type_name": "Query",
                    "field_name": "countries",
                    "disable_default_mapping": false,
                    "path": [
                        "countries"
                    ]
                }
            ],
            "data_sources": [
                {
                    "kind": "REST",
                    "name": "PetStore Data Source",
                    "internal": false,
                    "root_fields": [
                        {
                            "type": "Query",
                            "fields": [
                                "pet"
                            ]
                        }
                    ],
                    "config": {
                        "url": "https://petstore.swagger.io/v2/pet/{{.arguments.id}}",
                        "method": "GET",
                        "body": "",
                        "headers": {}
                    }
                },
                {
                    "kind": "GraphQL",
                    "name": "Countries Data Source",
                    "internal": false,
                    "root_fields": [
                        {
                            "type": "Query",
                            "fields": [
                                "countries"
                            ]
                        }
                    ],
                    "config": {
                        "url": "https://countries.trevorblades.com",
                        "method": "POST",
                        "body": ""
                    }
                }
            ]
        }
    }
}