Custom plugin for Kong v1.0.2 is enabled but not installed

kong plugins
kong, plugin not enabled; add it to the 'plugins' configuration property
luarocks install kong plugin
kong docker plugins
kong plugin development
kong documentation
kong configuration
kong database

I have a custom plugin for Kong which worked fine for Kong v0.14.1 but after I upgraded to v.1.0.2 it's throwing an error.

OS used: macOS Mojave

In kong.conf file I have this code:

log_level = debug
plugins=my-custom-plugin

I try to start Kong with this command:

kong start -c kong.conf

and I get this error:

Error: /usr/local/share/lua/5.1/kong/cmd/start.lua:50: nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:344: my-custom-plugin plugin is enabled but not installed; module 'kong.plugins.my-custom-plugin.handler' not found:No LuaRocks module found for kong.plugins.my-custom-plugin.handler no field package.preload['kong.plugins.my-custom-plugin.handler'] no file './kong/plugins/kong-my-custom-plugin/handler.lua'...

I installed the plugin using this command:

luarocks make

which gave the following output:

my-custom-plugin 1.0-1 is now installed in /usr/local/opt/kong (license: MIT)

Somehow, it appears that Kong is unable to find my installed custom plugin. Any idea why this happens?

Custom plugin not getting enabled for 1.x.x · Issue #4276 · Kong , I am trying to enable plugin in latest version of kong which was working fine in 0.14 version but cant see custom plugin in my-custom-plugin plugin is enabled but not installed; kong_1 | module SOLVED -- Kong v1.0.2. Summary I am developing a third party plugin, the problem is that when I start kong (using kong-vagrant) I get the message "plugin is in use but not enabled". If I hardcode the plugin in to custom_plugins in conf_loader.conf, it works no

Plugin Development - (un)Installing your plugin, Custom plugins for Kong consist of Lua source files that need to be in the file system “plugin is enabled but not installed” -> The plugin's name is present in the  Summary Migrations up does not recognize and execute the "up" command for a new custom plugin that uses DAO and is being installed in external folder location. The same plugin if installed in Kong's default installation path works fine.

It looks like it can't find the handler.lua file, which is required. Can you run $ tree . at the root of your plugin project?

Here's the result of that same command for a test plugin I did a while back (https://github.com/jerneyio/kong-plugin-header-echo)

$ tree .
.
├── README.md
├── kong
│   └── plugins
│       └── kong-plugin-header-echo
│           ├── handler.lua
│           └── schema.lua
├── kong-plugin-header-echo-0.1.0-1.all.rock
└── kong-plugin-header-echo-0.1.0-1.rockspec

Also, are you sure your handler.lua is exposed in your rockspec? Again, successful example here:

$ cat kong-plugin-header-echo-0.1.0-1.rockspec 
package = "kong-plugin-header-echo"
version = "0.1.0-1"
source = {
   url = "git//github.com/jerneyio/kong-plugin-header-echo.git"
}
description = {
   homepage = "https://github.com/jerneyio/kong-plugin-header-echo",
   license = "MIT"
}
dependencies = {
  "lua >= 5.3",
  "kong >= 0.14"
}
build = {
   type = "builtin",
   modules = {
      ["kong.plugins.kong-plugin-header-echo.handler"] = "kong/plugins/kong-plugin-header-echo/handler.lua",
      ["kong.plugins.kong-plugin-header-echo.schema"] = "kong/plugins/kong-plugin-header-echo/schema.lua"
   }
}

Plugin Development - Plugin Configuration - v1.4.x, Your plugin's configuration is stored in the datastore for Kong to retrieve it and pass it to your handler.lua curl -X POST http://kong:8001/services/<service-​name-or-id>/plugins \ -d enabled, boolean, Whether or not the plugin is enabled. Install Kong Gateway · Kong Community · Kubernetes Ingress · Kuma · Insomnia. To resolve, add the plugin’s name to the node’s custom_plugins directive. “plugin is enabled but not installed” -> The plugin’s name is present in the custom_plugins directive, but that Kong is unable to load the handler.lua source file from the file system. To resolve, make sure that the lua_package_path directive is properly set to load this plugin’s Lua sources.

Plugin Development - File Structure - v1.1.x, 0.14.x · 0.13.x · 0.12.x · 0.11.x · 0.10.x · 0.9.x · 0.8.x · 0.7.x · 0.6.x · 0.5.x · 0.4.x · 0.3.x · 0.2.x You are browsing documentation for an outdated version of Kong Kong Gateway. More on LuaRocks-installed plugins later in this guide. api.​lua, No, Defines a list of endpoints to be available in the Admin API to interact with  “plugin is enabled but not installed” -> The plugin’s name is present in the plugins directive, but that Kong is unable to load the handler.lua source file from the file system. To resolve, make sure that the lua_package_path directive is properly set to load this plugin’s Lua sources.

Plugin Installation, trying to start kong. Error: /usr/local/share/lua/5.1/kong/cmd/start.lua:57: nginx: [​error] init_by_lua error: token_limiting plugin is enabled but not ins… module 'kong.plugins.token_limiting.handler' not found:No LuaRocks module found for  Plugins can be installed and configured via the Admin API running alongside Kong. Almost all plugins can be customized not only to target a specific proxied service, but also to target specific Consumers. From a technical perspective, a plugin is Lua code that’s being executed during the life-cycle of a proxied request and response. Through

Plugin Development - Introduction - v1.2.x, lua-nginx-module enables Lua scripting capabilities in Nginx. OpenResty is not a fork of Nginx, but a bundle of modules extending its capabilities. Plugins consist of Lua modules interacting with the request/response objects or streams structure of plugins, what they can extend, and how to distribute and install them. For thoughts on how plugins execution order should be configurable in the future, see Kong/kong#267. Some plugins might depend on the execution of others to perform some operations. For example, plugins relying on the identity of the consumer have to run after authentication plugins.

Comments
  • Best answer so far! Based on this answer I identified where the plugin is installed, in my case was: "/usr/local/Cellar/kong/1.0.2/share/lua/5.1/kong/plugins/" and I set lua_package_path=/usr/local/Cellar/kong/1.0.2/share/lua/5.1/?.lua;; in my kong.conf file and now the plugin is found although I don't know why this doesn't happen automatically like in the previous versions of kong.
  • Yes handler.lua is exposed in rockspec and it worked on previous version of kong. The error is thrown when I try to start kong not when I install plugin.