Skip to content

Conversation

@mateo-di
Copy link
Collaborator

Description

Fixes the Prisma 403 error in Cloud Run where runtime tries to download binaries from npm
registry.

Root Cause

Commit b2a56a2 removed critical environment variables from the runtime `prisma
generate` command.

REMOVED (was working):
```dockerfile
RUN NPM_CONFIG_CACHE=/app/.cache/npm \
PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \
prisma generate
```

REPLACED WITH (broken):
```dockerfile
RUN prisma --version && \
prisma generate
```

Without these env vars, Prisma cannot find pre-cached binaries and attempts npm download →
403 error.

Solution

Restore `NPM_CONFIG_CACHE` and `PRISMA_BINARY_CACHE_DIR` to tell Prisma to use
pre-cached binaries at `/app/.cache/prisma-python/binaries`.

Type of change

  • Fix

Acceptance

  1. Build Docker image with this fix
  2. Deploy to Cloud Run
  3. Verify no Prisma 403 errors in startup logs
  4. Verify database migrations run successfully

Related

Root cause: Commit b2a56a2 removed NPM_CONFIG_CACHE and
PRISMA_BINARY_CACHE_DIR env vars from runtime prisma generate, causing
403 errors when Prisma tried to download from npm registry.

Solution: Restore env vars to tell Prisma to use pre-cached binaries
from builder stage at /app/.cache/prisma-python/binaries.

This fixes the Cloud Run error:
npm ERR! 403 403 Forbidden - GET https://registry.npmjs.org/prisma

Related: PR #13 (original working implementation)
@mateo-di mateo-di self-assigned this Nov 22, 2025
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