need redirect check bad for serverless runtime #237

Closed
opened 2026-02-16 01:15:04 -05:00 by yindo · 1 comment
Owner

Originally created by @fatelei on GitHub (Jan 27, 2026).

Self Checks

To make sure we get to you in time, please check the following :)

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • "Please do not modify this template :) and fill in all the required fields."

Versions

  1. dify-plugin-daemon Version
  2. dify-api Version

Describe the bug

need redirect check bad for serverless runtime

func (c *ControlPanel) GetPluginRuntime(
	pluginUniqueIdentifier plugin_entities.PluginUniqueIdentifier,
) (plugin_entities.PluginRuntimeSessionIOInterface, error) {
	if pluginUniqueIdentifier.RemoteLike() {
		runtime, ok := c.debuggingPluginRuntime.Load(pluginUniqueIdentifier)
		if !ok {
			return nil, ErrPluginRuntimeNotFound
		}
		return runtime, nil
	} else {
		runtime, ok := c.localPluginRuntimes.Load(pluginUniqueIdentifier)
		if !ok {
			return nil, ErrPluginRuntimeNotFound
		}
		return runtime, nil
	}
}

GetPluginRuntime check the debuggingPluginRuntime and localPluginRuntimes, when deploy in serverless platform, it still check in debuggingPluginRuntime and localPluginRuntimes, this is not right

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Originally created by @fatelei on GitHub (Jan 27, 2026). **Self Checks** To make sure we get to you in time, please check the following :) - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify-plugin-daemon/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] "Please do not modify this template :) and fill in all the required fields." **Versions** 1. dify-plugin-daemon Version 2. dify-api Version **Describe the bug** need redirect check bad for serverless runtime ``` func (c *ControlPanel) GetPluginRuntime( pluginUniqueIdentifier plugin_entities.PluginUniqueIdentifier, ) (plugin_entities.PluginRuntimeSessionIOInterface, error) { if pluginUniqueIdentifier.RemoteLike() { runtime, ok := c.debuggingPluginRuntime.Load(pluginUniqueIdentifier) if !ok { return nil, ErrPluginRuntimeNotFound } return runtime, nil } else { runtime, ok := c.localPluginRuntimes.Load(pluginUniqueIdentifier) if !ok { return nil, ErrPluginRuntimeNotFound } return runtime, nil } } ``` GetPluginRuntime check the debuggingPluginRuntime and localPluginRuntimes, when deploy in serverless platform, it still check in debuggingPluginRuntime and localPluginRuntimes, this is not right **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here.
yindo added the bug label 2026-02-16 01:15:04 -05:00
yindo closed this issue 2026-02-16 01:15:04 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 27, 2026):

The current GetPluginRuntime logic is not suitable for serverless deployments because it only checks in-memory maps (debuggingPluginRuntime and localPluginRuntimes), which do not exist or persist in stateless serverless environments. This approach fails in distributed or serverless setups, where plugin runtime state is not shared across instances, leading to runtime detection failures and "plugin not found" errors see code comment issue #577.

The correct approach for serverless runtime management is to use the Serverless Runtime Interface (SRI), which provides a set of HTTP APIs for packaging, launching, and managing plugins in serverless environments like AWS Lambda. The SRI is configured via environment variables (such as DIFY_PLUGIN_SERVERLESS_CONNECTOR_URL and DIFY_PLUGIN_SERVERLESS_CONNECTOR_API_KEY) and exposes endpoints for health checks, listing plugin instances, and launching plugins with real-time status updates via Server-Sent Events (SSE) see SRI docs PR #338.

To properly handle plugin runtime checks in serverless deployments, you should integrate with the SRI and related abstractions, not rely on local or debugging runtime maps. Note that serverless runtime support in the open-source version is currently in Alpha, and production-grade features are available in the enterprise edition. If you need multi-instance support, be aware that there is no built-in solution for synchronizing plugin runtime registration across pods or serverless instances in open source issue #577.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 27, 2026): <!-- Answer --> The current GetPluginRuntime logic is not suitable for serverless deployments because it only checks in-memory maps (debuggingPluginRuntime and localPluginRuntimes), which do not exist or persist in stateless serverless environments. This approach fails in distributed or serverless setups, where plugin runtime state is not shared across instances, leading to runtime detection failures and "plugin not found" errors [see code comment](https://github.com/langgenius/dify-plugin-daemon/blob/f272e6c3fcd8a18c6ff571d7fcbfde857f63ef99/internal/core/control_panel/runtime_export.go#L10-L27) [issue #577](https://github.com/langgenius/dify-plugin-daemon/issues/577). The correct approach for serverless runtime management is to use the Serverless Runtime Interface (SRI), which provides a set of HTTP APIs for packaging, launching, and managing plugins in serverless environments like AWS Lambda. The SRI is configured via environment variables (such as DIFY_PLUGIN_SERVERLESS_CONNECTOR_URL and DIFY_PLUGIN_SERVERLESS_CONNECTOR_API_KEY) and exposes endpoints for health checks, listing plugin instances, and launching plugins with real-time status updates via Server-Sent Events (SSE) [see SRI docs](https://github.com/langgenius/dify-plugin-daemon/blob/main/docs/runtime/sri.md) [PR #338](https://github.com/langgenius/dify-plugin-daemon/pull/338). To properly handle plugin runtime checks in serverless deployments, you should integrate with the SRI and related abstractions, not rely on local or debugging runtime maps. Note that serverless runtime support in the open-source version is currently in Alpha, and production-grade features are available in the enterprise edition. If you need multi-instance support, be aware that there is no built-in solution for synchronizing plugin runtime registration across pods or serverless instances in open source [issue #577](https://github.com/langgenius/dify-plugin-daemon/issues/577). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f35fb785-63bf-4c06-8941-a9c1990e5b7f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f35fb785-63bf-4c06-8941-a9c1990e5b7f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f35fb785-63bf-4c06-8941-a9c1990e5b7f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f35fb785-63bf-4c06-8941-a9c1990e5b7f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f35fb785-63bf-4c06-8941-a9c1990e5b7f?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f35fb785-63bf-4c06-8941-a9c1990e5b7f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f35fb785-63bf-4c06-8941-a9c1990e5b7f?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20current%20GetPluginRuntime%20logic%20is%20not%20suitable%20for%20serverless%20deployments%20because%20it%20only%20checks%20in-memory%20maps%20%28debuggingPluginRuntime%20and%20localPluginRuntimes%29%2C%20which%20do%20not%20exist%20or%20persist%20in%20stateless%20serverless%20environments.%20This%20approach%20fails%20in%20distributed%20or%20serverless%20setups%2C%20where%20plugin%20runtime%20state%20is%20not%20shared%20across%20instances%2C%20leading%20to%20runtime%20detection%20failures%20and%20%22plugin%20not%20found%22%20errors%C2%A0%5Bsee%20code%20comment%5D%28https%3A//github.com/langgenius/dify-plugin-daemon/blob/f272e6c3fcd8a18c6ff571d7fcbfde857f63ef99/internal/core/control_panel/runtime_export.go%23L10-L27%29%C2%A0%5Bissue%20%23577%5D%28https%3A//github.com/langgenius/dify-plugin-daemon/issues/577%29.%0A%0AThe%20correct%20approach%20for%20serverless%20runtime%20management%20is%20to%20use%20the%20Serverless%20Runtime%20Interface%20%28SRI%29%2C%20which%20provides%20a%20set%20of%20HTTP%20APIs%20for%20packaging%2C%20launching%2C%20and%20managing%20plugins%20in%20serverless%20environments%20like%20AWS%20Lambda.%20The%20SRI%20is%20configured%20via%20environment%20variables%20%28such%20as%20DIFY_PLUGIN_SERVERLESS_CONNECTOR_URL%20and%20DIFY_PLUGIN_SERVERLESS_CONNECTOR_API_KEY%29%20and%20exposes%20endpoints%20for%20health%20checks%2C%20listing%20plugin%20instances%2C%20and%20launching%20plugins%20with%20real-time%20status%20updates%20via%20Server-Sent%20Events%20%28SSE%29%C2%A0%5Bsee%20SRI%20docs%5D%28https%3A//github.com/langgenius/dify-plugin-daemon/blob/main/docs/runtime/sri.md%29%C2%A0%5BPR%20%23338%5D%28https%3A//github.com/langgenius/dify-plugin-daemon/pull/338%29.%0A%0ATo%20properly%20handle%20plugin%20runtime%20checks%20in%20serverless%20deployments%2C%20you%20should%20integrate%20with%20the%20SRI%20and%20related%20abstractions%2C%20not%20rely%20on%20local%20or%20debugging%20runtime%20maps.%20Note%20that%20serverless%20runtime%20support%20in%20the%20open-source%20version%20is%20currently%20in%20Alpha%2C%20and%20production-grade%20features%20are%20available%20in%20the%20enterprise%20edition.%20If%20you%20need%20multi-instance%20support%2C%20be%20aware%20that%20there%20is%20no%20built-in%20solution%20for%20synchronizing%20plugin%20runtime%20registration%20across%20pods%20or%20serverless%20instances%20in%20open%20source%C2%A0%5Bissue%20%23577%5D%28https%3A//github.com/langgenius/dify-plugin-daemon/issues/577%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-plugin-daemon/issues/586)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#237