Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure function is not called when plugin configuration changes #13930

Open
1 task done
CatbirdBasil opened this issue Nov 26, 2024 · 3 comments
Open
1 task done
Labels
pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc...

Comments

@CatbirdBasil
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

2.8.4.11

Current Behavior

I'm writing my Custom plugin. I set up configure callback like so:

function MyPlugin:configure(configs)
  -- Implement logic for the configure phase here
  --(called whenever there is change to any of the plugins)
  kong.log.err("configure")
end

And when I start kong container I try to change configuration of my plugin, for example like so:

PATCH http://10.100.52.6:8001/plugins/1c290177-7956-4745-9946-66b7672ff59d
{
  "name": "my-plugin",
  "config": {
    "limits": {"max_buffer_size": 42430}
  },
  "enabled": true
}

But the log message inside the callback is never printed.

I might be getting the way it works wrong and in such case sorry, but that's as much as I could understand from the documentation here Implementing Custom Logic

Expected Behavior

I expect log message inside configure callback to be printed once I execute:

PATCH http://10.100.52.6:8001/plugins/1c290177-7956-4745-9946-66b7672ff59d
{
  "name": "my-plugin",
  "config": {
    "limits": {"max_buffer_size": 42430}
  },
  "enabled": true
}

Steps To Reproduce

  1. Setup dummy custom plugin that only logs each phase/callback in handler.lua
  2. Add plugin configuration field to schema.lua
  3. Start kong with plugin available
  4. Add plugin configuration
  5. Change plugin configuration
  6. Expect to see logs for configure phase

Anything else?

No response

@xianghai2
Copy link

xianghai2 commented Dec 2, 2024

Hi @CatbirdBasil ,

You may need to enable the custom plugin, uncomment following line of kong.conf.default ( or kong.conf ):

   #plugins = bundled 

Change it to:

   plugins = bundled,my-plugin

Then, start Kong with kong.conf.

@xianghai2 xianghai2 added the pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc... label Dec 2, 2024
@CatbirdBasil
Copy link
Author

Hi, I already did that. Other callback are working fine like access or header_filter

@Water-Melon
Copy link
Contributor

Water-Melon commented Dec 9, 2024

Unfortunately, the configure phase handler was involved in version 3.5.0.0.
https://docs.konghq.com/gateway/changelog/#core-19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc...
Projects
None yet
Development

No branches or pull requests

3 participants