Skip to content

[TT-2015] - Clarify how plugins should query API Definition and/or ConfigData #3320

@mcandre

Description

@mcandre

The limited plugin examples are unclear how one would programmatically query the request's API Definition, ConfigData, etc. in order to parameterize behavior by API Definition.

Should this be done via ctx.GetDefinition?

Which hooks actually populate this method's value? Because many hooks have this returning nil API definition for some reason.

Using exactly Tyk v2.9.4.3, for both the tyk application and for building the plugin.

I tried Go 1.12, 1.13, and 1.14 with no apparent change in behavior.

I replaced the git submodule with a direct cp -r from the $GOPATH/src/... to vendor/..., with no change in behavior.

I tried all the available GO111MODULE values, with largely no effect. Other than flat out breaking compilation when set to on.

Making sure to use the same environment variables, build flags, host OS for both the Tyk binary and the Tyk plugin.

UPDATE

The problem disappears when I stop tracking my Go dependencies with vendor/, and instead place them in $GOPATH/src. Whatever crazy compiler differences are emerging at runtime for plugins on attempting to query Tyk data from requests, are triggered when the Tyk library is managed as a vendored directory.

This problem happens when tracking the Tyk library dependency for a plugin as a git submodule, for example.

Using the exact same commit for both my Tyk binary and my Tyk plugin, 6a4802a, tag v2.9.4.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions