TykTechnologies / tyk-sync

Tyk Sync - move Tyk configurations between multiple environments
Other
64 stars 23 forks source link

TT-12006 Syncing does not pick up API config changes #120

Closed laacz closed 2 months ago

laacz commented 1 year ago

While evaluating tyk, and testing tyk-sync in particular, I ran into an issue where it does not pick up changes within file svc-test-bearer.json.

tyk-sync version: 1.4.0 tyk version (run via docker): 4.3.3

.tyk.json:

{
    "type": "apidef",
    "files": [
        {
            "file": "client-mtls-api.json",
            "oas": {}
        },
        {
            "file": "ip.json",
            "oas": {}
        },
        {
            "file": "keyless-plugin-api.json",
            "oas": {}
        },
        {
            "file": "protected-api.json",
            "oas": {}
        },
        {
            "file": "svc-test-bearer.json",
            "oas": {}
        },
        {
            "file": "svc-test.json",
            "oas": {}
        }
    ]
}

Within svc-test-bearer.json I changed use_keyless from false to true. Then I ran the sync command:

Screenshot from the repo:

image

Grepping from tyk config:

grep keyless ../tyk/apps/svc-test-bearer.json

Result:

  "use_keyless": false,
tyk-sync sync -g http://localhost:8080/ -s sdmnakjsdnakslmdakslmdaklmda -b refs/heads/main git@my.repo.tld:user/tyk-sync.git

Output is as follows:

Fetched 6 definitions
Fetched 0 policies
Using publisher: Gateway Publisher
Processing APIs...
Deleting: 0
Updating: 6
Creating: 0
Updating API 0: ip
--> Status: OK, ID:ip
Updating API 1: Tyk Test Keyless API
Reloading...
--> Status: OK, ID:keyless
Reloading...
Updating API 2: Tyk Test API
--> Status: OK, ID:1
Updating API 3: svc-test-bearer
Reloading...
--> Status: OK, ID:svc-test-bearer
Updating API 4: svc-test
Reloading...
--> Status: OK, ID:svc-test
Reloading...
Updating API 5: mTls
--> Status: OK, ID:4a77d8bfe76f41ad7ae5875b2259df3f
Reloading...
SYNC Updated: ip
SYNC Updated: keyless
SYNC Updated: 1
SYNC Updated: svc-test-bearer
SYNC Updated: svc-test
SYNC Updated: 4a77d8bfe76f41ad7ae5875b2259df3f
SYNC Created: ip
SYNC Created: Tyk Test Keyless API
SYNC Created: Tyk Test API
SYNC Created: svc-test-bearer
SYNC Created: svc-test
SYNC Created: mTls
Reloading...

Let's check if use_keyless has been changed. Again, grepping from tyk config:

grep keyless ../tyk/apps/svc-test-bearer.json

Again - result:

  "use_keyless": false,

So, it's obvious, that syncing does not work when changing contents of the app definition. Documentation is not clear if this is a bug or feature.

swamy-m-s commented 9 months ago

its happening because of extra / in /tyk/apis/, due to this update calls were going to get call and we are getting 200 but actual update is not happening.

i have raised an pull request please review and merge https://github.com/TykTechnologies/tyk-sync/pull/132

komalsukhani commented 2 months ago

Resolved by PR #132