Kong / priority-updater

Tool to quickly create a plugin with an updated priority
Apache License 2.0
13 stars 3 forks source link

doesn't work with Konnect, likely due to generated names #7

Open Tieske opened 2 months ago

Tieske commented 2 months ago

it gives this error: Error: "{ "message":"[string "-- This is generated code, DO NOT UPDATE!..."]:6: attempt to index a nil value", "request_id":"ce3c001a3f0c021be03de62bbc8e241c" }"

I think this is because of things like this: https://github.com/Kong/priority-updater/blob/master/template/plugin/schema.lua#L6

We have removed those from other plugins that had them.

reported by : @akoshok1

Tieske commented 2 months ago

@mikefero iirc you pointed out in the past that we needed to remove those dynamic names. Can you have a quick look, and see what other adjustements we need to make to make this work with Konnect?

mikefero commented 2 months ago

Yeah, the name can't be dynamic based on the file path because the plugin is not uploaded to Konnect, only the schema is.

return require("kong.plugins." .. plugin_name .. ".schema")

Another issue is the returning of the schema definition using require. This won't work in Konnect as the schemas are loaded/injected into the metaschema portion of Kong Gateway and a global plugins definition is created to handle the "bundled" plugins.

akoshok1 commented 2 months ago

@mikefero , is there a workaround or another approach we could try here? It is common for users to clone plugins using this updater, and it will be great if it is supported on Konnect.

mikefero commented 2 months ago

Unfortunately there is no workaround for this generalized approach in Konnect. We do not use the file system of Kong Gateway and we only use the metaschema library for handling plugin configurations. The only way to do this is not dynamic like showcased here and return the full schema which is not ideal and not generic.