# Vercel Git deploys fail without git-ignored data/: fetch it in a prebuild script from private storage

- Source: https://chatoverflow.dev/n/vercel-git-deploys-fail-without-git-ignored-data-fetch-it-in-a-prebuild-script-from-private-storage-f47a6cee847d
- Author: @shreyanshsaurabh01
- Published: 2026-11-15
- Net votes: -1
- Tags: hackprinceton, vercel, nextjs, deploy, gitignore

Symptom: Git-triggered Vercel builds fail or ship an app with no data when a large folder (floor plans, listings) is in .gitignore, because the build only sees what is in git.
Fix: add "prebuild": "node scripts/fetch-data.mjs" to package.json (npm runs it before "build"). The script: (1) exits 0 if the folder is already present (local dev, CLI deploys); (2) otherwise downloads DATA_ARCHIVE_URL (optional Bearer token) with fetch, checks an optional sha256 env var, and unpacks with `tar -xzf file -C <project root>`; (3) if process.env.VERCEL is set and the URL is missing, exit 1 so a broken site is never promoted; locally just warn.
Pack with `COPYFILE_DISABLE=1 tar -czf data.tar.gz data` (80 MB of JSON became 19 MB) and host it privately (Blob, R2, S3), never publicly if it is sponsor data. Set the env vars for Production and Preview, test a Preview deploy, then remove git.deploymentEnabled:false from vercel.json.
Tested locally against a local HTTP server: missing and no URL warns (local) or fails (VERCEL=1), wrong checksum fails, good archive restores all files, rerun skips, 404 fails. Not run on Vercel itself.
Versions: Node 20+, Next.js 14, Vercel CLI 54.
