fix(resource): add plugin_configs support for fetch_latest_conf, fix ai-proxy-multi plugin with multi instance not support plugin_config_id#13458
Open
chryancclee-boop wants to merge 3 commits into
Conversation
When the ai-proxy-multi plugin uses plugin_config_id to reference a PluginConfig containing multiple instances, APISIX returns a 503 error: "fetch_latest_conf(): unsupported resource type: plugin_configs". Root cause: - pick_target() in ai-proxy-multi.lua calls resource.fetch_latest_conf() to fetch the parent configuration for load balancing and health checking. - When referencing via plugin_config_id, the _meta.parent.resource_key is set to "/plugin_configs/<id>". - resource.fetch_latest_conf() previously only supported upstreams, routes, services, and stream_routes, causing it to reject "plugin_configs". Why single instance works: - Single instance scenarios bypass pick_target() entirely since no load balancing is needed, so resource.fetch_latest_conf() is never invoked. Fix: - Add "plugin_configs" to the supported resource types in resource.lua. Verification: - Single instance + plugin_config_id: 200 (unchanged) - Multi-instance + plugin_config_id: 503 -> 200 (fixed) - Multi-instance + embedded plugins: 200 (unchanged) Signed-off-by: lichunhan <chryancc.lee@gmail.com>
When the ai-proxy-multi plugin uses plugin_config_id to reference a PluginConfig containing multiple instances, APISIX returns a 503 error: "fetch_latest_conf(): unsupported resource type: plugin_configs". Root cause: - pick_target() in ai-proxy-multi.lua calls resource.fetch_latest_conf() to fetch the parent configuration for load balancing and health checking. - When referencing via plugin_config_id, the _meta.parent.resource_key is set to "/plugin_configs/<id>". - resource.fetch_latest_conf() previously only supported upstreams, routes, services, and stream_routes, causing it to reject "plugin_configs". Why single instance works: - Single instance scenarios bypass pick_target() entirely since no load balancing is needed, so resource.fetch_latest_conf() is never invoked. Fix: - Add "plugin_configs" to the supported resource types in resource.lua. Verification: - Single instance + plugin_config_id: 200 (unchanged) - Multi-instance + plugin_config_id: 503 -> 200 (fixed) - Multi-instance + embedded plugins: 200 (unchanged) Signed-off-by: lichunhan <chryancc.lee@gmail.com>
Baoyuantop
reviewed
Jun 2, 2026
Contributor
Baoyuantop
left a comment
There was a problem hiding this comment.
Please provide the corresponding test cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the ai-proxy-multi plugin uses plugin_config_id to reference a PluginConfig containing multiple instances, APISIX returns a 503 error: "fetch_latest_conf(): unsupported resource type: plugin_configs".
Root cause:
Why single instance works:
Fix:
Verification:
Checklist