Why Source Maps Matter
Without source maps, production stack traces look like:
TypeError: Cannot read properties of undefined
at a.exports (chunk-HKDF2.js:1:34521)
With source maps:
TypeError: Cannot read properties of undefined
at UserList (src/components/UserList.tsx:24:18)
Upload via CLI
squasher sourcemaps upload \
--project $SQUASHER_PROJECT_ID \
--release $(git rev-parse HEAD) \
.next/static/chunks/*.map
The --release value must match the release in your init() config. This is how Squasher matches maps to events.
Upload via API
curl -X POST https://api.squasher.ai/v1/projects/{project_id}/sourcemaps \
-H "x-squasher-key: sq_pk_your_key" \
-F "release=v1.2.3" \
-F "files=@.next/static/chunks/main.js.map"
CI Integration
GitHub Actions
Vercel build
- name: Upload source maps
run: |
npx squasher sourcemaps upload \
--project ${{ secrets.SQUASHER_PROJECT_ID }} \
--release ${{ github.sha }} \
.next/static/chunks/*.map
env:
SQUASHER_API_KEY: ${{ secrets.SQUASHER_API_KEY }}
next build && npx squasher sourcemaps upload --project $SQUASHER_PROJECT_ID --release $VERCEL_GIT_COMMIT_SHA .next/static/chunks/*.map
Security
Source maps are stored encrypted and never served to end users. They are only used server-side to resolve stack traces.