fix: restore Prisma cache env vars to prevent npm - #37
Closed
mateo-di wants to merge 1 commit into
Closed
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Acceptance
Related