Prisma db push in offline setting
Hi,
For my application use case, it's hosted on an environment with no internet connection. When I run
npx prisma db push --schema <path> I get an error about trying to reach some host to download the binaries. Is it possible to skip this step? As the app is an image that had npm install ran on it so the prisma files are in the node modules2 Replies
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
Running
Build your image in an environment with internet access, run a Prisma command like
You can set environment variables to point Prisma to custom binary locations. However, this alone may not prevent checksum downloads unless you also have the checksum files available locally prisma2 needs a more security conscious installation method for binaries. 3. Skip Checksum Validation (Prisma 4.16.0+):
If you use Prisma version 4.16.0 or newer, you can set the environment variable: This will skip missing checksum validation and allow commands like
- Ensure all required binaries and checksums are present before going offline. - Use
npx prisma db push in an offline environment can fail if Prisma tries to download engine binaries or their checksum files, even if you already have the necessary files in node_modules. This is a common issue, especially in environments with no internet access or strict firewalls.
Why does this happen?
- Prisma CLI checks for required engine binaries and their checksums. If they're missing from the local cache or node_modules, it attempts to download them from the internet.
- Even if you set custom engine paths (e.g., with PRISMA_QUERY_ENGINE_LIBRARY), Prisma may still try to fetch checksum files online, causing failures in offline environments Is it possible to run "prisma generate" without internet connection?.
Workarounds and Solutions:
1. Pre-download Binaries and Checksums:Build your image in an environment with internet access, run a Prisma command like
npx prisma -v or prisma generate to ensure all required binaries and checksums are downloaded and cached. Then, copy the relevant cache directories (e.g., ~/.cache/prisma or node_modules/@prisma/engines) into your offline image. This approach has been reported to work for some users Control binary download and network access by CLI.
2. Use Environment Variables:You can set environment variables to point Prisma to custom binary locations. However, this alone may not prevent checksum downloads unless you also have the checksum files available locally prisma2 needs a more security conscious installation method for binaries. 3. Skip Checksum Validation (Prisma 4.16.0+):
If you use Prisma version 4.16.0 or newer, you can set the environment variable: This will skip missing checksum validation and allow commands like
db push to run offline,
as long as the binaries themselves are present Deploying to an offline environment fails because it tries to download a Prisma engine checksum file.
Summary:- Ensure all required binaries and checksums are present before going offline. - Use
PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1 with Prisma 4.16.0+ to skip checksum downloads.
- If you’re on an older version, you may need to upgrade or manually manage binaries and checksums.
If you still encounter issues, please provide your Prisma version and more details about your build process.Was the bot response helpful?