Issue with Custom Plugin Load Order and Foreign Entity Reference

Hello Kong Community,

I’m currently facing an issue with a custom plugin I’ve developed, named ‘customer-attributes’. This plugin has a dependency on the ‘keyauth’ plugin, specifically it references the ‘keyauth_credentials’ entity.

When I start Kong, I receive the following error:

[error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:702: error loading plugin schemas: on plugin 'customer-attributes': schema of custom plugin entity 'customer-attributes.customer_attributes' is invalid: schema refers to an invalid foreign entity: keyauth_credentials

It seems like the ‘customer-attributes’ plugin is being loaded before the ‘keyauth’ plugin, causing the ‘keyauth_credentials’ entity to be unavailable when the ‘customer-attributes’ plugin is loaded.

I’ve tried explicitly setting the plugin load order in the kong.conf file, but it doesn’t seem to have any effect.

I’m at a bit of a loss for how to resolve this issue. Does Kong support specifying the load order of plugins? If not, is there a recommended way to handle dependencies between custom plugins and other plugins or entities?

Any help or advice would be greatly appreciated.

Best,