Repository navigation
feat: add top-level Prisma Compute templates - #8562
Conversation
WalkthroughPrisma Compute examples for Hono, Next.js, and TanStack Start were added with Prisma schemas, seed scripts, deployment configuration, runtime routes, documentation, and template validation. ChangesPrisma Compute templates
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ComputeApp
participant PrismaClient
participant PostgreSQL
Client->>ComputeApp: Request application page or /api/users
ComputeApp->>PrismaClient: Query users with related posts
PrismaClient->>PostgreSQL: Execute database query
PostgreSQL-->>PrismaClient: Return users and posts
PrismaClient-->>ComputeApp: Return query results
ComputeApp-->>Client: Return rendered page or JSON
Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
369b26e to
3d45ee1
Compare
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (3)
compute/nextjs/src/lib/prisma.ts (1)
11-13: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCache the Prisma client during development.
This module constructs a new PostgreSQL pool and Prisma client whenever it is re-evaluated. Development reloads can therefore accumulate connections and eventually exhaust the database pool. Cache the client on
globalThisin non-production, constructing the adapter only on a cache miss.Proposed fix
-const adapter = new PrismaPg({ connectionString: databaseUrl }); - -export const prisma = new PrismaClient({ adapter }); +const globalForPrisma = globalThis as typeof globalThis & { + prisma?: PrismaClient; +}; + +export const prisma = + globalForPrisma.prisma ?? + new PrismaClient({ + adapter: new PrismaPg({ connectionString: databaseUrl }), + }); + +if (process.env.NODE_ENV !== "production") { + globalForPrisma.prisma = prisma; +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/nextjs/src/lib/prisma.ts` around lines 11 - 13, Update the Prisma initialization around the exported prisma client to cache it on globalThis in non-production environments, reusing the cached client on module reloads. Construct PrismaPg and PrismaClient only on a cache miss, while preserving a fresh client path for production.compute/hono/.gitignore (1)
5-5: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDo not ignore Prisma migration history.
The README creates migrations under
prisma/migrations; ignoring this directory means schema history is not tracked or reproducible from a fresh checkout. Remove this entry unless the template intentionally recreates migrations every time.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/hono/.gitignore` at line 5, Remove the prisma/migrations entry from .gitignore so Prisma migration history generated by the README remains tracked and reproducible from a fresh checkout.compute/tanstack-start/.gitignore (1)
6-6: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winThe documented migration workflow conflicts with the ignore policy. The README creates migrations, but the repository ignores them, preventing schema history from being reproduced from source control.
compute/tanstack-start/.gitignore#L6-L6: stop ignoringprisma/migrationsunless schema application is intentionally out of band.compute/tanstack-start/README.md#L21-L23: document the tracked migration workflow or explicitly document the required out-of-band schema step.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/tanstack-start/.gitignore` at line 6, Align the migration policy with the documented workflow: in compute/tanstack-start/.gitignore at lines 6-6, stop ignoring prisma/migrations so generated migration history can be committed; in compute/tanstack-start/README.md at lines 21-23, document that migrations are tracked and applied from source control, or explicitly document the required out-of-band schema application step.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@compute/hono/prisma.config.ts`:
- Around line 10-12: Make the datasource URL in the Prisma configuration
optional by replacing the required env lookup in compute/hono/prisma.config.ts
at lines 10-12 with process.env.DATABASE_URL or an equivalent optional fallback,
while preserving the existing URL when provided. The build command in
compute/hono/package.json at line 7 requires no direct change; it should
continue allowing credential-free prisma generate.
In `@compute/hono/src/index.ts`:
- Around line 32-35: Update the user list rendering in the map callback used by
the root HTML response to HTML-escape user.name, user.email, and user.username
before interpolation, including fallback values as appropriate. Preserve the
existing displayed values and post counts while ensuring database-controlled
text cannot be interpreted as markup.
In `@compute/nextjs/prisma.config.ts`:
- Around line 10-12: Update the datasource configuration in prisma.config.ts to
read DATABASE_URL through process.env.DATABASE_URL instead of the throwing env
helper, so Prisma CLI commands such as generate can load without the variable
being set.
In `@compute/tanstack-start/src/styles.css`:
- Around line 17-19: Update the global anchor rule in styles.css to use a link
color with at least 4.5:1 contrast against the default white canvas, replacing
`#0c6` while preserving the existing link styling scope.
In `@tests/compute.test.ts`:
- Around line 75-80: Update the rootEntries validation in the compute test to
read and parse prisma.compute.json rather than only asserting its filename is
present. Assert the required Compute configuration fields, including the
framework metadata and Hono port setting, while retaining the existing
supported-lockfile assertion.
- Around line 9-13: Update the smoke validation in the test setup and the
affected smoke checks to use each template manifest’s template.smoke.path
instead of the hardcoded smokeRouteByFramework mapping. Assert that the declared
path matches the expected framework contract, then read and validate that
declared path so incorrect deployment routes fail the tests.
- Around line 82-92: Extend the test flow around the existing execa npm ci
dry-run to add a dedicated clean-build assertion. After dependency installation,
run the repository’s package-manager-specific build command in its own CI step,
ensuring the build executes without ignored scripts and validates required
generation such as prisma generate.
---
Nitpick comments:
In `@compute/hono/.gitignore`:
- Line 5: Remove the prisma/migrations entry from .gitignore so Prisma migration
history generated by the README remains tracked and reproducible from a fresh
checkout.
In `@compute/nextjs/src/lib/prisma.ts`:
- Around line 11-13: Update the Prisma initialization around the exported prisma
client to cache it on globalThis in non-production environments, reusing the
cached client on module reloads. Construct PrismaPg and PrismaClient only on a
cache miss, while preserving a fresh client path for production.
In `@compute/tanstack-start/.gitignore`:
- Line 6: Align the migration policy with the documented workflow: in
compute/tanstack-start/.gitignore at lines 6-6, stop ignoring prisma/migrations
so generated migration history can be committed; in
compute/tanstack-start/README.md at lines 21-23, document that migrations are
tracked and applied from source control, or explicitly document the required
out-of-band schema application step.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6fa1f139-540c-4595-8c89-afbf96356d11
⛔ Files ignored due to path filters (3)
compute/hono/package-lock.jsonis excluded by!**/package-lock.jsoncompute/nextjs/package-lock.jsonis excluded by!**/package-lock.jsoncompute/tanstack-start/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (49)
.gitignoreREADME.mdcompute/README.mdcompute/hono/.env.examplecompute/hono/.gitignorecompute/hono/README.mdcompute/hono/package.jsoncompute/hono/prisma.compute.jsoncompute/hono/prisma.config.tscompute/hono/prisma/schema.prismacompute/hono/prisma/seed.tscompute/hono/src/index.tscompute/hono/src/lib/prisma.tscompute/hono/tsconfig.jsoncompute/nextjs/.env.examplecompute/nextjs/.gitignorecompute/nextjs/README.mdcompute/nextjs/next.config.tscompute/nextjs/package.jsoncompute/nextjs/prisma.compute.jsoncompute/nextjs/prisma.config.tscompute/nextjs/prisma/schema.prismacompute/nextjs/prisma/seed.tscompute/nextjs/src/app/api/users/route.tscompute/nextjs/src/app/layout.tsxcompute/nextjs/src/app/page.tsxcompute/nextjs/src/lib/prisma.tscompute/nextjs/tsconfig.jsoncompute/tanstack-start/.env.examplecompute/tanstack-start/.gitignorecompute/tanstack-start/README.mdcompute/tanstack-start/package.jsoncompute/tanstack-start/prisma.compute.jsoncompute/tanstack-start/prisma.config.tscompute/tanstack-start/prisma/schema.prismacompute/tanstack-start/prisma/seed.tscompute/tanstack-start/src/lib/prisma.server.tscompute/tanstack-start/src/routeTree.gen.tscompute/tanstack-start/src/router.tsxcompute/tanstack-start/src/routes/__root.tsxcompute/tanstack-start/src/routes/api/users.tscompute/tanstack-start/src/routes/index.tsxcompute/tanstack-start/src/styles.csscompute/tanstack-start/tsconfig.jsoncompute/tanstack-start/vite.config.tscompute/templates.jsondeployment-platforms/README.mdtests/compute.test.tstests/deployment-platforms.test.ts
💤 Files with no reviewable changes (2)
- deployment-platforms/README.md
- tests/deployment-platforms.test.ts
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 7
🧹 Nitpick comments (3)
compute/nextjs/src/lib/prisma.ts (1)
11-13: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCache the Prisma client during development.
This module constructs a new PostgreSQL pool and Prisma client whenever it is re-evaluated. Development reloads can therefore accumulate connections and eventually exhaust the database pool. Cache the client on
globalThisin non-production, constructing the adapter only on a cache miss.Proposed fix
-const adapter = new PrismaPg({ connectionString: databaseUrl }); - -export const prisma = new PrismaClient({ adapter }); +const globalForPrisma = globalThis as typeof globalThis & { + prisma?: PrismaClient; +}; + +export const prisma = + globalForPrisma.prisma ?? + new PrismaClient({ + adapter: new PrismaPg({ connectionString: databaseUrl }), + }); + +if (process.env.NODE_ENV !== "production") { + globalForPrisma.prisma = prisma; +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/nextjs/src/lib/prisma.ts` around lines 11 - 13, Update the Prisma initialization around the exported prisma client to cache it on globalThis in non-production environments, reusing the cached client on module reloads. Construct PrismaPg and PrismaClient only on a cache miss, while preserving a fresh client path for production.compute/hono/.gitignore (1)
5-5: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDo not ignore Prisma migration history.
The README creates migrations under
prisma/migrations; ignoring this directory means schema history is not tracked or reproducible from a fresh checkout. Remove this entry unless the template intentionally recreates migrations every time.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/hono/.gitignore` at line 5, Remove the prisma/migrations entry from .gitignore so Prisma migration history generated by the README remains tracked and reproducible from a fresh checkout.compute/tanstack-start/.gitignore (1)
6-6: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winThe documented migration workflow conflicts with the ignore policy. The README creates migrations, but the repository ignores them, preventing schema history from being reproduced from source control.
compute/tanstack-start/.gitignore#L6-L6: stop ignoringprisma/migrationsunless schema application is intentionally out of band.compute/tanstack-start/README.md#L21-L23: document the tracked migration workflow or explicitly document the required out-of-band schema step.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/tanstack-start/.gitignore` at line 6, Align the migration policy with the documented workflow: in compute/tanstack-start/.gitignore at lines 6-6, stop ignoring prisma/migrations so generated migration history can be committed; in compute/tanstack-start/README.md at lines 21-23, document that migrations are tracked and applied from source control, or explicitly document the required out-of-band schema application step.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@compute/hono/prisma.config.ts`:
- Around line 10-12: Make the datasource URL in the Prisma configuration
optional by replacing the required env lookup in compute/hono/prisma.config.ts
at lines 10-12 with process.env.DATABASE_URL or an equivalent optional fallback,
while preserving the existing URL when provided. The build command in
compute/hono/package.json at line 7 requires no direct change; it should
continue allowing credential-free prisma generate.
In `@compute/hono/src/index.ts`:
- Around line 32-35: Update the user list rendering in the map callback used by
the root HTML response to HTML-escape user.name, user.email, and user.username
before interpolation, including fallback values as appropriate. Preserve the
existing displayed values and post counts while ensuring database-controlled
text cannot be interpreted as markup.
In `@compute/nextjs/prisma.config.ts`:
- Around line 10-12: Update the datasource configuration in prisma.config.ts to
read DATABASE_URL through process.env.DATABASE_URL instead of the throwing env
helper, so Prisma CLI commands such as generate can load without the variable
being set.
In `@compute/tanstack-start/src/styles.css`:
- Around line 17-19: Update the global anchor rule in styles.css to use a link
color with at least 4.5:1 contrast against the default white canvas, replacing
`#0c6` while preserving the existing link styling scope.
In `@tests/compute.test.ts`:
- Around line 75-80: Update the rootEntries validation in the compute test to
read and parse prisma.compute.json rather than only asserting its filename is
present. Assert the required Compute configuration fields, including the
framework metadata and Hono port setting, while retaining the existing
supported-lockfile assertion.
- Around line 9-13: Update the smoke validation in the test setup and the
affected smoke checks to use each template manifest’s template.smoke.path
instead of the hardcoded smokeRouteByFramework mapping. Assert that the declared
path matches the expected framework contract, then read and validate that
declared path so incorrect deployment routes fail the tests.
- Around line 82-92: Extend the test flow around the existing execa npm ci
dry-run to add a dedicated clean-build assertion. After dependency installation,
run the repository’s package-manager-specific build command in its own CI step,
ensuring the build executes without ignored scripts and validates required
generation such as prisma generate.
---
Nitpick comments:
In `@compute/hono/.gitignore`:
- Line 5: Remove the prisma/migrations entry from .gitignore so Prisma migration
history generated by the README remains tracked and reproducible from a fresh
checkout.
In `@compute/nextjs/src/lib/prisma.ts`:
- Around line 11-13: Update the Prisma initialization around the exported prisma
client to cache it on globalThis in non-production environments, reusing the
cached client on module reloads. Construct PrismaPg and PrismaClient only on a
cache miss, while preserving a fresh client path for production.
In `@compute/tanstack-start/.gitignore`:
- Line 6: Align the migration policy with the documented workflow: in
compute/tanstack-start/.gitignore at lines 6-6, stop ignoring prisma/migrations
so generated migration history can be committed; in
compute/tanstack-start/README.md at lines 21-23, document that migrations are
tracked and applied from source control, or explicitly document the required
out-of-band schema application step.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6fa1f139-540c-4595-8c89-afbf96356d11
⛔ Files ignored due to path filters (3)
compute/hono/package-lock.jsonis excluded by!**/package-lock.jsoncompute/nextjs/package-lock.jsonis excluded by!**/package-lock.jsoncompute/tanstack-start/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (49)
.gitignoreREADME.mdcompute/README.mdcompute/hono/.env.examplecompute/hono/.gitignorecompute/hono/README.mdcompute/hono/package.jsoncompute/hono/prisma.compute.jsoncompute/hono/prisma.config.tscompute/hono/prisma/schema.prismacompute/hono/prisma/seed.tscompute/hono/src/index.tscompute/hono/src/lib/prisma.tscompute/hono/tsconfig.jsoncompute/nextjs/.env.examplecompute/nextjs/.gitignorecompute/nextjs/README.mdcompute/nextjs/next.config.tscompute/nextjs/package.jsoncompute/nextjs/prisma.compute.jsoncompute/nextjs/prisma.config.tscompute/nextjs/prisma/schema.prismacompute/nextjs/prisma/seed.tscompute/nextjs/src/app/api/users/route.tscompute/nextjs/src/app/layout.tsxcompute/nextjs/src/app/page.tsxcompute/nextjs/src/lib/prisma.tscompute/nextjs/tsconfig.jsoncompute/tanstack-start/.env.examplecompute/tanstack-start/.gitignorecompute/tanstack-start/README.mdcompute/tanstack-start/package.jsoncompute/tanstack-start/prisma.compute.jsoncompute/tanstack-start/prisma.config.tscompute/tanstack-start/prisma/schema.prismacompute/tanstack-start/prisma/seed.tscompute/tanstack-start/src/lib/prisma.server.tscompute/tanstack-start/src/routeTree.gen.tscompute/tanstack-start/src/router.tsxcompute/tanstack-start/src/routes/__root.tsxcompute/tanstack-start/src/routes/api/users.tscompute/tanstack-start/src/routes/index.tsxcompute/tanstack-start/src/styles.csscompute/tanstack-start/tsconfig.jsoncompute/tanstack-start/vite.config.tscompute/templates.jsondeployment-platforms/README.mdtests/compute.test.tstests/deployment-platforms.test.ts
💤 Files with no reviewable changes (2)
- deployment-platforms/README.md
- tests/deployment-platforms.test.ts
🛑 Comments failed to post (7)
compute/hono/prisma.config.ts (1)
10-12: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n== package.json ==\n' cat -n compute/hono/package.json printf '\n== prisma.config.ts ==\n' cat -n compute/hono/prisma.config.ts printf '\n== search for DATABASE_URL usage ==\n' rg -n "DATABASE_URL|prisma generate|prisma.config" compute/hono -SRepository: prisma/prisma-examples
Length of output: 1973
🌐 Web query:
Prisma config env() DATABASE_URL prisma generate config load behavior💡 Result:
In Prisma, the
env()helper function fromprisma/configis designed to strictly enforce the presence of environment variables [1][2]. When used inprisma.config.ts, this helper will throw aPrismaConfigEnvErrorand prevent any Prisma CLI command from executing if the specified environment variable is missing [1][2][3]. Because every Prisma CLI command loads theprisma.config.tsfile upon execution, this can cause issues with commands that do not strictly require a database URL—such asprisma generate[1][2][4]. Whileprisma generateprimarily uses the schema file to generate the client, the configuration load behavior forces a check of allenv()calls withinprisma.config.ts[1][4]. To handle scenarios where an environment variable (likeDATABASE_URL) may be optional or missing (e.g., in certain CI/CD pipelines or environments where the URL is not needed for specific commands), you should avoid theenv()helper [1][2][4]. Instead, you should access the environment variable directly usingprocess.env[1][4][3]. Recommended patterns: For strict requirements (ensures the variable exists): import { env } from 'prisma/config';... datasource: { url: env("DATABASE_URL"), }, For optional requirements (avoids errors if missing): datasource: { url: process.env.DATABASE_URL!, // or use a fallback: process.env.DATABASE_URL?? '' }, To ensure Prisma can read your.envfile within theprisma.config.tscontext, you must also manually importdotenv/configat the top of yourprisma.config.tsfile [1][2][5].Citations:
- 1: https://www.prisma.io/docs/orm/reference/prisma-config-reference
- 2: https://www.prisma.io/docs/orm/v6/reference/prisma-config-reference
- 3: prisma/orm#28869
- 4: prisma/orm#28590
- 5: https://www.prisma.io/docs/orm/v6/prisma-client/setup-and-configuration/generating-prisma-client
Avoid requiring
DATABASE_URLforprisma generate.
env("DATABASE_URL")makes Prisma fail while loadingcompute/hono/prisma.config.ts, so the build step incompute/hono/package.jsonbreaks in environments that don’t provide database credentials. Useprocess.env.DATABASE_URLor another optional fallback there so client generation stays credential-free.📍 Affects 2 files
compute/hono/prisma.config.ts#L10-L12(this comment)compute/hono/package.json#L7-L7🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/hono/prisma.config.ts` around lines 10 - 12, Make the datasource URL in the Prisma configuration optional by replacing the required env lookup in compute/hono/prisma.config.ts at lines 10-12 with process.env.DATABASE_URL or an equivalent optional fallback, while preserving the existing URL when provided. The build command in compute/hono/package.json at line 7 requires no direct change; it should continue allowing credential-free prisma generate.compute/hono/src/index.ts (1)
32-35: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Escape database values before embedding them in HTML.
user.name,user.email, anduser.usernameare interpolated directly intoc.html; any non-seed value containing markup will execute when/is viewed. HTML-escape these text values before interpolation or use a context-aware renderer.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/hono/src/index.ts` around lines 32 - 35, Update the user list rendering in the map callback used by the root HTML response to HTML-escape user.name, user.email, and user.username before interpolation, including fallback values as appropriate. Preserve the existing displayed values and post counts while ensuring database-controlled text cannot be interpreted as markup.compute/nextjs/prisma.config.ts (1)
10-12: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
sed -n '1,120p' compute/nextjs/prisma.config.ts printf '\n---\n' sed -n '1,220p' compute/nextjs/package.json printf '\n---\n' rg -n "prisma generate|DATABASE_URL|prisma/config|env\\(" compute/nextjs -SRepository: prisma/prisma-examples
Length of output: 1973
🌐 Web query:
Prisma config reference env("DATABASE_URL") missing environment variable prisma generate loads config build failure💡 Result:
The error occurs because the
env()helper function inprisma.config.ts(introduced in Prisma ORM v7) is designed to enforce the presence of environment variables [1][2]. When you run any Prisma CLI command—includingprisma generate—Prisma loads yourprisma.config.tsfile [1][2][3]. Ifenv("DATABASE_URL")is used, theenv()function immediately throws aPrismaConfigEnvErrorif the specified variable is undefined, causing the entire command to fail, even if the specific command (likegenerate) does not strictly require a database connection [1][2][3]. To resolve this issue in environments where the database URL is not available (such as CI/CD pipelines or Docker build stages), useprocess.envinstead of theenv()helper [1][2][3]. ### Recommended Solution Replace theenv()helper in yourprisma.config.tswith direct access toprocess.env[2][3]:typescript import "dotenv/config"; import { defineConfig } from "prisma/config"; export default defineConfig({ schema: "prisma/schema.prisma", // ... other config datasource: { // Using process.env avoids the strict validation enforced by env() url: process.env.DATABASE_URL!, }, });### Why this happens 1. Theenv()helper fromprisma/configis intended for scenarios where you want to strictly enforce that a configuration value must be present [2]. 2. Becauseprisma.config.tsis loaded by every Prisma CLI command, theenv()validation runs prematurely for commands that do not actually need to connect to a database [1][2]. 3. By usingprocess.env.DATABASE_URL(or providing a fallback likeprocess.env.DATABASE_URL ?? ''), you bypass theenv()helper's strict requirement, allowingprisma generateto complete successfully even when the URL is missing [2][3]. ### Additional Tips - Ensure you havedotenv/configimported at the top of yourprisma.config.tsto ensure local.envfiles are loaded intoprocess.env[1][4][2]. - If you are in a CI/Docker environment, you can also set a dummy value during the build step (e.g.,DATABASE_URL=ignore prisma generate) as a temporary workaround [5][3], but theprocess.envapproach is the recommended, cleaner fix [2].Citations:
- 1: prisma/orm#28590
- 2: https://www.prisma.io/docs/orm/v6/reference/prisma-config-reference
- 3: prisma/orm#28869
- 4: https://stackoverflow.com/questions/79805715/error-prismaconfigenverror-missing-required-environment-variable-database-ur
- 5: prisma/orm#28708
Keep Prisma config loading independent of
DATABASE_URL.
prisma.config.tsis loaded by every Prisma CLI command, andenv("DATABASE_URL")throws if the variable is missing. That makesprisma generatefail duringnpm run buildin environments that don’t inject the database URL. Useprocess.env.DATABASE_URLhere, or guarantee the variable is always present at build time.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/nextjs/prisma.config.ts` around lines 10 - 12, Update the datasource configuration in prisma.config.ts to read DATABASE_URL through process.env.DATABASE_URL instead of the throwing env helper, so Prisma CLI commands such as generate can load without the variable being set.Source: MCP tools
compute/tanstack-start/src/styles.css (1)
17-19: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use a contrast-safe link color.
#0c6on the default white canvas is approximately 2.1:1, below the WCAG AA 4.5:1 minimum for normal text. (w3.org)Proposed fix
a { - color: `#0c6`; + color: `#006b3c`; }📝 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.a { color: `#006b3c`; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compute/tanstack-start/src/styles.css` around lines 17 - 19, Update the global anchor rule in styles.css to use a link color with at least 4.5:1 contrast against the default white canvas, replacing `#0c6` while preserving the existing link styling scope.Source: MCP tools
tests/compute.test.ts (3)
9-13: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Exercise the manifest-declared smoke path.
template.smoke.pathis validated but ignored; the test reads a hardcoded source file instead. A manifest can declare an incorrect deployment route and still pass. Assert the declared path against the framework contract and use it in smoke validation.Also applies to: 67-70, 94-102
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/compute.test.ts` around lines 9 - 13, Update the smoke validation in the test setup and the affected smoke checks to use each template manifest’s template.smoke.path instead of the hardcoded smokeRouteByFramework mapping. Assert that the declared path matches the expected framework contract, then read and validate that declared path so incorrect deployment routes fail the tests.
75-80: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Validate
prisma.compute.jsoncontents, not just its presence.A malformed configuration or missing framework/port metadata can pass because the test only counts the filename. Parse each file and assert the required Compute configuration, including Hono’s port setting.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/compute.test.ts` around lines 75 - 80, Update the rootEntries validation in the compute test to read and parse prisma.compute.json rather than only asserting its filename is present. Assert the required Compute configuration fields, including the framework metadata and Hono port setting, while retaining the existing supported-lockfile assertion.
82-92: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail # Inspect the relevant test file and nearby context. wc -l tests/compute.test.ts sed -n '1,180p' tests/compute.test.ts # Find package manifests and scripts that the test might be exercising. git ls-files '**/package.json' '**/npm-shrinkwrap.json' '**/package-lock.json' '**/pnpm-lock.yaml' '**/yarn.lock' # Look for build/generate-related scripts and prisma usage. rg -n '"(build|generate|prisma|prepare|postinstall|prebuild)"' -g 'package.json' -g '!**/node_modules/**' . rg -n 'prisma generate|npm run build|build:' -g '!**/node_modules/**' .Repository: prisma/prisma-examples
Length of output: 1973
🏁 Script executed:
#!/bin/bash set -euo pipefail # Map the test file structure so we only read the needed parts if it is large. ast-grep outline tests/compute.test.ts --view expandedRepository: prisma/prisma-examples
Length of output: 1973
🏁 Script executed:
#!/bin/bash set -euo pipefail # Read the test file around the relevant lines. cat -n tests/compute.test.ts | sed -n '1,180p'Repository: prisma/prisma-examples
Length of output: 1973
🏁 Script executed:
#!/bin/bash set -euo pipefail # Show the full test file with line numbers. cat -n tests/compute.test.ts # Show neighboring test filenames to infer the suite's purpose. git ls-files tests | sed -n '1,200p'Repository: prisma/prisma-examples
Length of output: 1973
Add a clean-build assertion. This only runs
npm ci --dry-run --ignore-scripts, so it won’t catch build failures or missingprisma generate. Run the package-manager-specific build in a dedicated CI step.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/compute.test.ts` around lines 82 - 92, Extend the test flow around the existing execa npm ci dry-run to add a dedicated clean-build assertion. After dependency installation, run the repository’s package-manager-specific build command in its own CI step, ensuring the build executes without ignored scripts and validates required generation such as prisma generate.Source: MCP tools
|
@coderabbitai approve |
✅ Action performedComments resolved and changes approved. |
Summary
compute/hono,compute/nextjs, andcompute/tanstack-start.compute/templates.jsonwith source paths and smoke checks for click-to-deploy.prisma.compute.jsonand a lockfile to every template.Checks
npx vitest run tests/compute.test.ts tests/deployment-platforms.test.tsnpm ci --ignore-scriptsin all three templatesnpm run buildin all three templates withDATABASE_URLsetSummary by CodeRabbit