Hi, I’m successfully setting up an API using tyk-sync. However, when I try tyk-sync update, the API is not being updated.
Here are the files:
.tyk.json
{
"type": "apidef",
"files": [
{
"file": "api.json",
"oas": {}
}
]
}
api.json
{
"api_definition": {
"name": "test",
"api_id": "test",
"id": "test",
"slug": "test",
"use_keyless": true
"proxy": {
"listen_path": "/test/",
"strip_listen_path": true,
"target_url": "http://example.com"
},
"CORS": {
"enable": true
},
"version_data": {
"not_versioned": true,
"default_version": "",
"versions": {
"": {}
}
}
},
"oas": {
"openapi": "3.0.3",
"info": {
"title": "test",
"version": "v1"
},
"servers": [
{
"url": "http://example.com/test/"
}
],
"security": [],
"tags": [
{
"name": "TestService"
}
],
"paths": {
"/v1/test": {
"post": {
"tags": [
"TestService"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TestResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/rpcStatus"
}
}
}
}
},
"x-codegen-request-body-name": "body"
}
}
},
"components": {
"schemas": {
"entitiesContent": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"globalId": {
"type": "string"
},
"distributionIds": {
"type": "array",
"items": {
"type": "string"
}
},
"attributes": {
"$ref": "#/components/schemas/protobufAny"
}
}
},
"entitiesLocation": {
"type": "object",
"properties": {
"longitude": {
"type": "number",
"format": "float"
},
"latitude": {
"type": "number",
"format": "float"
}
}
},
"entitiesUserContext": {
"type": "object",
"properties": {
"locations": {
"type": "array",
"items": {
"$ref": "#/components/schemas/entitiesLocation"
}
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string",
"description": ""
}
},
"additionalProperties": {
"type": "object"
},
"description": ""
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/components/schemas/protobufAny"
}
}
}
},
"TestRequest": {
"title": "simple message",
"type": "object",
"properties": {
"userContext": {
"$ref": "#/components/schemas/entitiesUserContext"
},
"queries": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Query"
}
}
}
},
"TestResponse": {
"type": "object",
"properties": {
"content": {
"type": "array",
"items": {
"$ref": "#/components/schemas/entitiesContent"
}
}
}
},
"Query": {
"type": "object",
"properties": {
"keyword": {
"type": "string"
}
}
}
}
}
}
}
Here’s the command:
tyk-sync publish --path=. --gateway="https://gateway-example.com" --secret="MY_SECRET"
That works fine. However, when I change, say, the listen_path
or basically modify api.json in any way and run tyk-sync, the changes don’t propagate to the gateway.
# Update doesn't work
tyk-sync update --path=. --gateway="https://gateway-example.com" --secret="MY_SECRET"
# Sync doesn't work
tyk-sync sync --path=. --gateway="https://gateway-example.com" --secret="MY_SECRET"
The only way to get the changes to show up is to delete the API and re-publish it.
We verified this unexpected behaviour in our tyk-gateway, as well as independently with a Tyk engineer (@zaid).