Skip to content

fix(cloud): ensure DATABASE_URL before pnpm install on Cloud agents#140

Closed
mkayander wants to merge 1 commit into
mainfrom
cursor/cloud-agent-update-script-510a
Closed

fix(cloud): ensure DATABASE_URL before pnpm install on Cloud agents#140
mkayander wants to merge 1 commit into
mainfrom
cursor/cloud-agent-update-script-510a

Conversation

@mkayander
Copy link
Copy Markdown
Owner

Problem

Cloud agent pnpm install failed during postinstall because Prisma could not resolve DATABASE_URL:

PrismaConfigEnvError: Cannot resolve environment variable: DATABASE_URL

The update flow started PostgreSQL and ran pnpm install before a .env file existed.

Solution

  1. .cursor/environment.json — points install at bash .cursor/cloud-agent-update.sh and starts PostgreSQL on machine boot.
  2. .cursor/cloud-agent-update.sh — idempotent update script: start Postgres → ensure .env from template → pnpm installpnpm prisma:push.
  3. .cursor/cloud-agent.env.template — committed local-dev defaults (PostgreSQL URL, SKIP_ENV_VALIDATION, placeholder OAuth/AWS keys).
  4. prisma.config.ts — fallback to postgresql://dstruct:dstruct@localhost:5432/dstruct when env vars are unset so prisma generate succeeds during postinstall even without .env.
  5. .env.example / AGENTS.md — aligned docs and example with PostgreSQL + install flow.

Verification

Ran bash .cursor/cloud-agent-update.sh on a clean VM (no .env): postinstall, Prisma generate, GraphQL codegen, and prisma db push all succeeded.

Dashboard note

If a saved Cloud environment still uses a custom update command (e.g. bare pnpm install), either switch to repo .cursor/environment.json or ensure .env exists before install.

Open in Web Open in Cursor 

- Add .cursor/environment.json and cloud-agent-update.sh install script
- Seed .env from cloud-agent.env.template when missing
- Fall back to local PostgreSQL URL in prisma.config.ts for prisma generate
- Align .env.example with PostgreSQL and document install flow in AGENTS.md
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dstruct Ready Ready Preview, Comment May 21, 2026 7:36pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants