-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
β¨ feat: add INTERNAL_APP_URL for server-to-server calls
#9960
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
base: next
Are you sure you want to change the base?
Conversation
|
@XYenon is attempting to deploy a commit to the LobeHub OSS Team on Vercel. A member of the Team first needs to authorize it. |
Reviewer's GuideThis PR introduces a new INTERNAL_APP_URL environment variable (falling back to APP_URL) for internal server-to-server calls, updates the application configuration and async client to use it, adds corresponding tests, and documents the change in the Docker Compose guides. Sequence diagram for async server-to-server call using INTERNAL_APP_URLsequenceDiagram
participant S as "Async Caller (Server)"
participant E as "LobeChat Server"
S->>E: POST /trpc/async (using INTERNAL_APP_URL)
E-->>S: Response
Class diagram for updated app environment configurationclassDiagram
class AppEnv {
+APP_URL: string
+INTERNAL_APP_URL: string
+getAppConfig()
}
AppEnv <|-- getAppConfig
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
π @XYenon Thank you for raising your pull request and contributing to our Community |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/server/routers/async/__tests__/caller.test.ts:3` </location>
<code_context>
+# to bypass CDN/proxy. If not set, defaults to APP_URL.
+# Example: INTERNAL_APP_URL=http://localhost:3210
AUTH_URL=http://localhost:3210/api/auth
# Postgres related, which are the necessary environment variables for DB
</code_context>
<issue_to_address>
**issue (testing):** No test implementation found for async caller logic.
Please implement tests to ensure server-to-server calls use INTERNAL_APP_URL and fallback to APP_URL as needed, and include cases for error handling with missing or malformed URLs.
</issue_to_address>Help me be more useful! Please click π or π on each comment and I'll use the feedback to improve your reviews.
| @@ -0,0 +1,121 @@ | |||
| // @vitest-environment node | |||
| import { describe, expect, it, vi } from 'vitest'; | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (testing): No test implementation found for async caller logic.
Please implement tests to ensure server-to-server calls use INTERNAL_APP_URL and fallback to APP_URL as needed, and include cases for error handling with missing or malformed URLs.
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #9960 +/- ##
==========================================
- Coverage 81.90% 80.73% -1.17%
==========================================
Files 879 896 +17
Lines 56224 57354 +1130
Branches 7724 8750 +1026
==========================================
+ Hits 46051 46306 +255
- Misses 10173 11048 +875
Flags with carried forward coverage won't be shown. Click here to find out more.
π New features to boost your workflow:
|
4961580 to
2657b06
Compare
da4d7a6 to
356ac07
Compare
|
@XYenon please rebase the next ~ thx |
INTERNAL_APP_URL for server-to-server calls
Add INTERNAL_APP_URL environment variable to bypass CDN/proxy for internal operations like embedding and file chunking. Falls back to APP_URL if not set. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Add documentation for INTERNAL_APP_URL environment variable in: - docker-compose .env.example - Docker Compose deployment guide (English and Chinese) Explains how to bypass CDN/proxy for server-to-server operations. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Add comprehensive test coverage for INTERNAL_APP_URL: - Test fallback behavior to APP_URL when INTERNAL_APP_URL is not set - Test explicit INTERNAL_APP_URL configuration - Test localhost bypass for CDN/proxy - Test createAsyncServerClient using INTERNAL_APP_URL - Test authentication headers in async calls Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
356ac07 to
91f31b8
Compare
π» Change Type
π Description of Change
Add INTERNAL_APP_URL environment variable to bypass CDN/proxy for internal operations like embedding and file chunking. Falls back to APP_URL if not set.
π§ͺ How to Test
Summary by Sourcery
Add the INTERNAL_APP_URL environment variable to support bypassing CDN or proxy for internal server-to-server calls, update the async caller to use this URL, and include corresponding documentation and tests.
New Features:
Documentation:
Tests: