Skip to content

chore(release): staging to production - 2025.11.24 - #725

Merged
bradtaylorsf merged 1 commit into
productionfrom
staging
Nov 24, 2025
Merged

chore(release): staging to production - 2025.11.24#725
bradtaylorsf merged 1 commit into
productionfrom
staging

Conversation

@github-actions

Copy link
Copy Markdown

🚀 Release: Staging to Production

Release Date: 2025-11-24

Changes in this release


This PR is automatically created/updated when commits are pushed to staging.
Merging this PR will trigger the release workflow to create a new GitHub release.

… failures (#724)

## Problem

Deployments have been failing since November 19, 2025 when Prisma 7.0.0
was released. The root cause was a version mismatch between the Prisma
CLI used at runtime vs. the project's dependencies:

- **Project uses:** Prisma 5.22.0 (locked in package.json and
pnpm-lock.yaml)
- **Docker runtime installed:** Prisma 7.0.0 (latest via `npm install -g
prisma`)
- **Breaking change in Prisma 7:** The `url` property in the datasource
block is no longer supported

### Error Symptoms

```
Error: P1012: error: Error validating datasource `db`: the preview feature "postgresqlExtensions" is not known
  -->  schema.prisma:15
   |
14 |   provider = "postgresql"
15 |   url      = env("DATABASE_URL")
   |

Validation Error Count: 1
```

This occurred because:
1. Dockerfile ran `npm install -g prisma` which installed 7.0.0 globally
2. At runtime, `entrypoint.sh` used the global `prisma` command (7.0.0)
3. Prisma 7.0.0 tried to read schema.prisma written for Prisma 5.22.0
4. Version incompatibility caused validation errors and deployment
failures

---

## Solution

**Use the project's Prisma version instead of a global install:**

### Changes Made

1. **Removed global Prisma installation** (`apps/web/Dockerfile`)
   - Deleted: `RUN npm install -g prisma`
   - Global installs always get the latest version, causing drift

2. **Copy node_modules to runtime stage** (`apps/web/Dockerfile`)
- Added: `COPY --from=installer --chown=nextjs:nodejs /app/node_modules
./node_modules`
- Ensures Prisma CLI 5.22.0 from project dependencies is available at
runtime

3. **Use npx to invoke Prisma** (`apps/web/entrypoint.sh`)
   - Changed: `prisma migrate deploy` → `npx prisma migrate deploy`
   - npx uses the project's local Prisma version from node_modules

### Why This Works

- **Version consistency:** Runtime uses the exact Prisma version
specified in package.json
- **No global installs:** Avoids "latest version" drift
- **Explicit versioning:** npx resolves Prisma from ./node_modules, not
global PATH
- **Future-proof:** When we upgrade Prisma, both build and runtime use
the same version

---

## Testing

### Verified Locally

```bash
# Build Docker image
docker build -t theanswer-web -f apps/web/Dockerfile .

# Run with database
docker run --rm -p 3000:3000 \
  -e DATABASE_URL="postgresql://example_user:example_password@host.docker.internal:5432/example_db" \
  theanswer-web

# Observed successful output:
# ✓ Running database migration...
# ✓ Attempting database migration deployment...
# ✓ Prisma Migrate applied the following migration(s):
# ✓ 20241120000000_init
# ✓ Starting Next.js server...
```

### Test Plan for Deployment

- [ ] Build succeeds without errors
- [ ] Container starts successfully
- [ ] Prisma migrations execute using 5.22.0
- [ ] No schema validation errors
- [ ] Application serves traffic normally

---

## Impact

**Scope:** Critical deployment fix

**Affected Areas:**
- Docker build process (Dockerfile)
- Container runtime (entrypoint.sh)
- Database migrations (Prisma CLI invocation)

**Risk:** Low
- Changes are isolated to Docker build and entrypoint script
- No application code changes
- Uses project's existing Prisma version (no upgrade)
- Falls back to same behavior as before global install was added

**Rollback:** Revert this PR if issues occur

---

## Related Issues

- **AGENT-429:** Fix Docker Prisma version mismatch causing deployment
failures
- **Root cause:** Prisma 7.0.0 release on Nov 19, 2025 introduced
breaking changes
- **Timeline:** Deployments failing since Nov 19, 2025

---

## Checklist

- [x] Removed global Prisma installation from Dockerfile
- [x] Added node_modules copy to runtime stage
- [x] Updated entrypoint.sh to use `npx prisma`
- [x] Tested Docker build locally
- [x] Verified Prisma version consistency (5.22.0)
- [x] Confirmed no schema validation errors
- [x] Ready for staging deployment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 24, 2025

Copy link
Copy Markdown

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

Project Deployment Preview Updated (UTC)
answerai-docs Building Building Preview Nov 24, 2025 1:08am
the-answerai Building Building Preview Nov 24, 2025 1:08am

@bradtaylorsf
bradtaylorsf merged commit d310989 into production Nov 24, 2025
8 of 10 checks passed
@maxtechera
maxtechera temporarily deployed to staging - aai-unified2-flowise-moonstruck November 24, 2025 01:09 — with Render Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants