fix: Fallback to request host url when CONSOLE_API_URL is empty for O…#36848
Open
04AvinashSingh wants to merge 16 commits into
Open
fix: Fallback to request host url when CONSOLE_API_URL is empty for O…#3684804AvinashSingh wants to merge 16 commits into
04AvinashSingh wants to merge 16 commits into
Conversation
…Auth callbacks Resolves #36833 Self-hosted users deploying via docker-compose encounter OAuth failures (e.g., SharePoint AADSTS90102) because CONSOLE_API_URL defaults to empty, resulting in relative callback URIs. Added a get_console_api_url() helper that gracefully falls back to request.host_url when the environment variable is blank. Updated all trigger, plugin, SSO, and tool callback generators to use this absolute URL helper.
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-06-01 11:56:01.653711637 +0000
+++ /tmp/pyrefly_pr.txt 2026-06-01 11:55:47.883584381 +0000
@@ -67,7 +67,7 @@
ERROR Class member `PluginToolProviderController.entity` overrides parent class `BuiltinToolProviderController` in an inconsistent manner [bad-override-mutable-attribute]
--> core/tools/plugin_tool/provider.py:12:5
ERROR Cannot set item in `dict[str, dict[str, Any]]` [unsupported-operation]
- --> core/tools/tool_manager.py:1110:58
+ --> core/tools/tool_manager.py:1111:58
ERROR `(method: str, url: str, max_retries: int = ..., **kwargs: Any) -> httpx._models.Response` is not assignable to attribute `perform_request` with type `(self: CloudScraper, method: Unknown, url: Unknown, *args: Unknown, **kwargs: Unknown) -> requests.models.Response` [bad-assignment]
--> core/tools/utils/web_reader_tool.py:66:35
ERROR `list[Never]` is not assignable to attribute `tools` with type `Never` [bad-assignment]
@@ -557,7 +557,7 @@
ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
--> services/account_service.py:1383:13
ERROR `+` is not supported between `str` and `dict[Unknown, Unknown]` [unsupported-operation]
- --> services/app_service.py:519:53
+ --> services/app_service.py:520:53
ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
--> services/audio_service.py:144:56
ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
@@ -4178,6 +4178,8 @@
--> tests/unit_tests/core/datasource/utils/test_message_transformer.py:329:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `db_provider` with type `MCPToolProvider` in function `core.entities.mcp_provider.MCPProviderEntity.from_db_model` [bad-argument-type]
--> tests/unit_tests/core/entities/test_entities_mcp_provider.py:59:46
+ERROR No attribute `dify_config` in module `core.entities.mcp_provider` [missing-attribute]
+ --> tests/unit_tests/core/entities/test_entities_mcp_provider.py:70:25
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/core/entities/test_entities_provider_configuration.py:666:12
ERROR Argument `SimpleNamespace` is not assignable to parameter `credential_record` with type `ProviderCredential | ProviderModelCredential` in function `core.entities.provider_configuration.ProviderConfiguration._update_load_balancing_configs_with_credential` [bad-argument-type]
|
Contributor
Pyrefly Type Coverage
|
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.
Fixes langgenius/dify-official-plugins#3238
Summary
Self-hosted users deploying via docker-compose encounter OAuth failures (e.g., SharePoint
AADSTS90102) becauseCONSOLE_API_URLdefaults to empty, resulting in relative callback URIs being sent to the identity provider.This PR adds a
get_console_api_url()helper that gracefully falls back torequest.host_urlwhen the environment variable is blank. It updates all trigger, plugin, SSO, and tool callback generators to use this helper, ensuring absolute URLs are reliably generated right out of the box without requiring manual.envconfiguration.Screenshots
N/A - Backend API fix for OAuth URL generation. No UI changes.
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods