-
Notifications
You must be signed in to change notification settings - Fork 1
Remove replace #50
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
Remove replace #50
Conversation
Deploying with
|
Status | Name | Latest Commit | Preview URL | Updated (UTC) |
---|---|---|---|---|
✅ Deployment successful! View logs |
claim-db-worker | 8a9936e | Commit Preview URL Branch Preview URL |
Aug 27 2025, 05:53 PM |
WalkthroughUpdated create-db/index.js to use direct environment variable checks with defaults for CREATE_DB_WORKER_URL and CLAIM_DB_WORKER_URL, removing trailing-slash trimming. Bumped package versions to 1.0.6 in create-db, create-pg, and create-postgres. Changes
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Preview CLIs & Workers are live! Test the CLIs locally under tag npx create-db@pr50
npx create-pg@pr50
npx create-postgres@$pr50 Worker URLs
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
create-db/index.js
(1 hunks)create-db/package.json
(1 hunks)create-pg/package.json
(1 hunks)create-postgres/package.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Workers Builds: claim-db-worker
- GitHub Check: Workers Builds: create-db-worker
🔇 Additional comments (3)
create-postgres/package.json (1)
3-3
: Version bump looks good.Consistent with the other packages in this PR. No issues.
create-db/package.json (1)
3-3
: Version bump looks good.Aligned with dependent workspace packages. No concerns.
create-pg/package.json (1)
3-3
: Version bump looks good.Matches the workspace set. Ship it.
const CREATE_DB_WORKER_URL = | ||
process.env.CREATE_DB_WORKER_URL.replace(/\/+$/, "") || | ||
"https://create-db-temp.prisma.io"; | ||
process.env.CREATE_DB_WORKER_URL || "https://create-db-temp.prisma.io"; | ||
const CLAIM_DB_WORKER_URL = | ||
process.env.CLAIM_DB_WORKER_URL.replace(/\/+$/, "") || | ||
"https://create-db.prisma.io"; | ||
process.env.CLAIM_DB_WORKER_URL || "https://create-db.prisma.io"; |
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.
🧹 Nitpick (assertive)
Avoid double-slash endpoints after removing trailing-slash trim
Direct concat will produce URLs like ...//analytics
if the env var ends with /
. Many servers tolerate it, but some proxies/CDNs can 301/404 or log differently. Prefer URL-based joining to keep the “no replace” intent and be robust.
Apply this minimal change near the constants:
-const CREATE_DB_WORKER_URL =
- process.env.CREATE_DB_WORKER_URL || "https://create-db-temp.prisma.io";
-const CLAIM_DB_WORKER_URL =
- process.env.CLAIM_DB_WORKER_URL || "https://create-db.prisma.io";
+const CREATE_DB_WORKER_URL =
+ process.env.CREATE_DB_WORKER_URL || "https://create-db-temp.prisma.io";
+const CLAIM_DB_WORKER_URL =
+ process.env.CLAIM_DB_WORKER_URL || "https://create-db.prisma.io";
+const joinUrl = (base, pathOrQuery) => new URL(pathOrQuery, base).toString();
Then update call sites (examples):
fetch(joinUrl(CREATE_DB_WORKER_URL, "/analytics"), ...)
const healthUrl = joinUrl(CREATE_DB_WORKER_URL, "/health")
const url = joinUrl(CREATE_DB_WORKER_URL, "/regions")
fetch(joinUrl(CREATE_DB_WORKER_URL, "/create"), ...)
const claimUrl = joinUrl(CLAIM_DB_WORKER_URL, \
?projectID=${projectId}&utm_source=${userAgent}&utm_medium=cli`)`
Quick check to run locally: set CREATE_DB_WORKER_URL
with and without a trailing slash and verify no //
appears in requests and no redirects occur.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const CREATE_DB_WORKER_URL = | |
process.env.CREATE_DB_WORKER_URL.replace(/\/+$/, "") || | |
"https://create-db-temp.prisma.io"; | |
process.env.CREATE_DB_WORKER_URL || "https://create-db-temp.prisma.io"; | |
const CLAIM_DB_WORKER_URL = | |
process.env.CLAIM_DB_WORKER_URL.replace(/\/+$/, "") || | |
"https://create-db.prisma.io"; | |
process.env.CLAIM_DB_WORKER_URL || "https://create-db.prisma.io"; | |
// src/create-db/index.js | |
const CREATE_DB_WORKER_URL = | |
process.env.CREATE_DB_WORKER_URL || "https://create-db-temp.prisma.io"; | |
const CLAIM_DB_WORKER_URL = | |
process.env.CLAIM_DB_WORKER_URL || "https://create-db.prisma.io"; | |
// Helper to robustly join a base URL and a path or query string without producing “//” | |
const joinUrl = (base, pathOrQuery) => new URL(pathOrQuery, base).toString(); |
🤖 Prompt for AI Agents
In create-db/index.js around lines 15-18 the constants are concatenated with
paths which can produce double-slash URLs if the env vars end with a trailing
slash; implement a small URL-joining helper (e.g., joinUrl(base, path) that
normalizes trailing/leading slashes or uses the URL API) and replace direct
concatenations at the listed call sites so calls become
fetch(joinUrl(CREATE_DB_WORKER_URL, "/analytics"), ...), const healthUrl =
joinUrl(CREATE_DB_WORKER_URL, "/health"), const url =
joinUrl(CREATE_DB_WORKER_URL, "/regions"), fetch(joinUrl(CREATE_DB_WORKER_URL,
"/create"), ...), and const claimUrl = joinUrl(CLAIM_DB_WORKER_URL,
`?projectID=${projectId}&utm_source=${userAgent}&utm_medium=cli`); verify
locally by setting the env vars with and without trailing slashes to ensure no
"//" appears and no redirects occur.
Summary by CodeRabbit
Bug Fixes
Chores