# Custom plugin enabled but not installed

**URL:** https://discuss.konghq.com/t/custom-plugin-enabled-but-not-installed/12839
**Category:** General
**Created:** [July 10, 2024, 6:22pm UTC](https://discuss.konghq.com/t/custom-plugin-enabled-but-not-installed/12839 "2024-07-10T18:22:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sher85](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/sher85/32/4545_2.png) [@sher85](https://discuss.konghq.com/u/sher85)
#### Post date: [July 10, 2024, 6:22pm UTC](https://discuss.konghq.com/t/custom-plugin-enabled-but-not-installed/12839/1 "2024-07-10T18:22:34Z")

</div>

Hi,

Is this the proper way to add JS plugins?  
I am running into a “_ **plugin is enabled but not installed** _” issue when attempting to install custom Javascript plugins to my Kong API (Traditional set up) running on docker.

**Plugin creation:**

1. [Write plugins in JavaScript](https://docs.konghq.com/gateway/3.7.x/plugin-development/pluginserver/javascript/)
2. [Use Plugins With Containers](https://docs.konghq.com/gateway/3.7.x/plugin-development/pluginserver/plugins-kubernetes/)
3. Build docker container and start kong inside of it so I can see the error logs, folder structures, etc.

When I run my container I get this:

```auto
$ kong start --v
2024/07/10 18:09:26 [verbose] Kong: 3.7.0
2024/07/10 18:09:26 [verbose] reading config file at /etc/kong/kong.conf
2024/07/10 18:09:26 [verbose] prefix in use: /usr/local/kong
2024/07/10 18:09:26 [verbose] preparing nginx prefix directory at /usr/local/kong
2024/07/10 18:09:26 [verbose] SSL enabled on admin_gui, no custom certificate set: using default certificates
2024/07/10 18:09:26 [verbose] generating admin_gui SSL certificate (/usr/local/kong/ssl/admin-gui-kong-default.crt) and key (/usr/local/kong/ssl/admin-gui-kong-default.key) for listener
2024/07/10 18:09:26 [verbose] generating admin_gui SSL certificate (/usr/local/kong/ssl/admin-gui-kong-default-ecdsa.crt) and key (/usr/local/kong/ssl/admin-gui-kong-default-ecdsa.key) for listener
2024/07/10 18:09:26 [verbose] generating trusted certs combined file in /usr/local/kong/.ca_combined
2024/07/10 18:09:26 [verbose] generating ffdhe2048 DH parameters
2024/07/10 18:09:26 [verbose] retrieving cache schema state...
2024/07/10 18:09:26 [verbose] schema state retrieved
2024/07/10 18:09:26 [verbose] could not start Kong, stopping services
2024/07/10 17:28:57 [verbose] stopped services
Error: 
/usr/local/share/lua/5.1/kong/cmd/start.lua:110: /usr/local/share/lua/5.1/kong/cmd/start.lua:99: nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:7
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:707: error loading plugin schemas: on plugin 'kongPlugin': kongPlugin plugin is enabled but not installed;
no plugin found; on plugin 'helloWorld': helloWorld plugin is enabled but not installed;
no plugin found
stack traceback:
        [C]: in function 'assert'
        /usr/local/share/lua/5.1/kong/init.lua:707: in function 'init'
        init_by_lua(nginx-kong.conf:41):3: in main chunk

stack traceback:
        [C]: in function 'error'
        /usr/local/share/lua/5.1/kong/cmd/start.lua:110: in function 'cmd_exec'
        /usr/local/share/lua/5.1/kong/cmd/init.lua:31: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:31>
        [C]: in function 'xpcall'
        /usr/local/share/lua/5.1/kong/cmd/init.lua:31: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:15>
        (command line -e):7: in function 'inline_gen'
        init_worker_by_lua(nginx.conf:130):44: in function <init_worker_by_lua(nginx.conf:130):43>
        [C]: in function 'xpcall'
        init_worker_by_lua(nginx.conf:130):52: in function <init_worker_by_lua(nginx.conf:130):50>

```

This is what my **Dockerfile** looks like:

```auto
FROM kong:3.7.0
USER root

# Install dependencies
RUN apt-get update && apt-get install -y nodejs npm
RUN npm install -g kong-pdk

# Copy config files, plugins, and install
COPY kong.yaml /usr/local/kong/declarative/kong.yaml
COPY kong.conf /etc/kong/kong.conf
COPY helloWorld.js kongPlugin.js package.json /usr/local/kong/js-plugins/
WORKDIR /usr/local/kong/js-plugins
RUN npm install

# Reset back to default user
USER kong
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 8000 8443 8001 8444
CMD ["kong", "docker-start"]

```

and **kong.conf** file where I specify the two additional plugins:

```auto
database = off
declarative_config = /usr/local/kong/declarative/kong.yaml

# Enable JavaScript plugins
plugins = bundled,helloWorld,kongPlugin

# Plugin server configuration
pluginserver_names = js
pluginserver_js_start_cmd = /usr/local/bin/kong-js-pluginserver -v --plugins-directory /usr/local/kong/js-plugins
pluginserver_js_query_cmd = /usr/local/bin/kong-js-pluginserver --plugins-directory /usr/local/kong/js-plugins --dump-all-plugins
pluginserver_js_socket = /usr/local/kong/js_pluginserver.sock

# Proxy and Admin API listen addresses
proxy_listen = 0.0.0.0:8000
admin_listen = 0.0.0.0:8001

```

I have verified that the JS files and package.json files are copied over to their respective directories inside docker as well as verified that npm installs node\_modules for them. Am I missing something?

---

<div class="post-metadata">

### Author: ![Mithun](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/mithun/32/4366_2.png) [@Mithun](https://discuss.konghq.com/u/Mithun)
#### Post date: [July 11, 2024, 7:06am UTC](https://discuss.konghq.com/t/custom-plugin-enabled-but-not-installed/12839/2 "2024-07-11T07:06:05Z")

</div>

Hi,

Using JS plugins with Kong is a bit complicated task. The better option is to use Lua because it is better and faster than another backend language. Javascript plugin documentation is not very clear, I have started a PR to include some examples:

> <https://github.com/Kong/docs.konghq.com/pull/7349>
>
> \### Description
> 
> \- added example configuration for Javascript custom plugins
> …- added some required dependency when running TypeScript 
> 
> \### Testing instructions
> 
> Preview link: 
> 
> \### Checklist 
> 
> \- \[x \] Review label added 
> \- \[x \] \[Conditional version tags\](https://docs.konghq.com/contributing/conditional-rendering/#conditionally-render-content-by-version) added, if applicable.

On the above question, the JS plugin server creates a “js\_pluginserver.sock”, so if more than one plugin is running, you may need to define a different name with a “–sock-name” option.

/usr/local/bin/kong-js-pluginserver -v --plugins-directory /usr/local/kong/ts-plugins --sock-name ts\_pluginserver.sock

Let me know if you have any issues.
