-
-
Notifications
You must be signed in to change notification settings - Fork 725
Delete the secure param before passing it to the ClickHouse client #2161
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
Conversation
|
WalkthroughThe initialization process for the ClickHouse client was updated to parse the connection URL from the ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/webapp/app/services/clickhouseInstance.server.ts (1)
15-16
: Document why the secure parameter is removed.The secure parameter removal aligns with the PR objective, but consider adding a comment explaining why this is necessary for the ClickHouse client.
- // Remove secure param + // Remove secure param - the ClickHouse client handles TLS configuration separately url.searchParams.delete("secure");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/webapp/app/services/clickhouseInstance.server.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
apps/webapp/app/services/clickhouseInstance.server.ts (2)
18-18
: Improved logging for better debugging.The console log now displays the actual host, which is more informative than the generic message. This is a good improvement for debugging and monitoring.
21-21
: Correctly uses the modified URL string.The implementation correctly converts the modified URL object back to a string after removing the secure parameter, ensuring the ClickHouse client receives the intended URL format.
const url = new URL(env.CLICKHOUSE_URL); | ||
|
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.
🛠️ Refactor suggestion
Add error handling for URL parsing.
The URL constructor will throw an error if env.CLICKHOUSE_URL
is malformed. Consider adding error handling to provide a more informative error message.
- const url = new URL(env.CLICKHOUSE_URL);
+ let url;
+ try {
+ url = new URL(env.CLICKHOUSE_URL);
+ } catch (error) {
+ console.error(`🗃️ Invalid CLICKHOUSE_URL: ${env.CLICKHOUSE_URL}`, error);
+ return;
+ }
🤖 Prompt for AI Agents
In apps/webapp/app/services/clickhouseInstance.server.ts around lines 13 to 14,
the URL constructor is used directly on env.CLICKHOUSE_URL without error
handling, which can throw if the URL is malformed. Wrap the URL construction in
a try-catch block to catch any errors, and throw a new error with a clear,
informative message indicating that the CLICKHOUSE_URL environment variable is
invalid or malformed.
No description provided.