# Deploy IssueCapture on Vercel

Wire your IssueCapture widget up for Vercel — env vars, preview deployments, custom domains. About 10 minutes if you already have the widget installed locally.

## Quick Summary

Time: ~10 minutes

Prerequisites: Vercel account + git repo

Process: Env var → Domains allowlist → Deploy

Works with: Next.js, React, Vue, Angular

## Prerequisites

- ✓Vercel account ([sign up free](https://vercel.com/signup))
- ✓App with IssueCapture installed (see [Next.js](https://issuecapture.com/docs/install/nextjs), [React](https://issuecapture.com/docs/install/react), [Vue](https://issuecapture.com/docs/install/vue), or [Angular](https://issuecapture.com/docs/install/angular))
- ✓Git repository (GitHub, GitLab, or Bitbucket)
- ✓IssueCapture account ([sign up free — includes 10 issues/month (a soft limit)](https://issuecapture.com/signup))

## Step-by-Step Installation

Follow these steps to get up and running in minutes.

### 1. Get Your API Key

Sign up for IssueCapture and grab your widget API key

- Go to issuecapture.com/signup and create a free account
- Connect your Jira instance via OAuth (about 30 seconds)
- Open the Widgets page and create a new widget
- Click the "API Keys" tab on your widget and copy the API key (starts with "ic_")

### 2. Add the env var in Vercel

Configure your IssueCapture API key in the Vercel dashboard

- Settings → Environment Variables
- Use the right prefix for your bundler (Next.js / Vite / CRA — Angular doesn't use env-prefixed vars)
- Tick all three environment scopes so previews work too
- You need to redeploy after adding env vars — push a new commit or use "Redeploy" in Vercel

```bash
# Vercel → your project → Settings → Environment Variables

# Variable name (pick the prefix that matches your framework):
NEXT_PUBLIC_ISSUECAPTURE_API_KEY    # Next.js
VITE_ISSUECAPTURE_API_KEY           # Vite (Vue / React)
REACT_APP_ISSUECAPTURE_API_KEY      # Create React App

# Value:
ic_your_api_key_here

# Environments to enable:
Production
Preview
Development
```

### 3. Add your Vercel domains to the allowlist

Tell IssueCapture which sites can use this API key

- In the IssueCapture dashboard, open your widget and click the Domains tab
- Add your production domain (custom or .vercel.app)
- For previews, add the branch URL you test with (e.g. `your-app-git-staging-your-team.vercel.app`). It stays the same as that branch gets new deploys. Per-deployment URLs contain a hash and change on every deploy, so list those only for one-off tests
- Do not add `*.vercel.app`. Every site hosted on Vercel sits under that domain, so the wildcard would let any of them submit to your widget. Wildcards only cover subdomains of a domain you own (`*.yourdomain.com`), and a pattern such as `your-app-*.vercel.app` is not supported
- Add your local dev port if you want to test the widget locally

```bash
# Domains to add in IssueCapture dashboard → Widgets → (your widget) → Domains

# Your production domain (one of these, plus www if you serve both):
your-app.vercel.app
yourdomain.com

# A preview branch URL (stable for that branch; repeat for each branch you test):
your-app-git-staging-your-team.vercel.app

# Local dev (optional):
localhost:3000   # Next.js
localhost:5173   # Vite
localhost:4200   # Angular
```

### 4. Deploy

Push your code — Vercel handles the rest

- A git push to your production branch (usually main) triggers a production deploy
- Pushes to any other branch get a preview URL
- Vercel auto-detects the framework (Next.js, Vite, CRA, Angular) and runs the right build
- Env vars are inlined into the browser bundle at build time — make sure they're set BEFORE the first deploy you want them in

```bash
# Option 1: Git-connected deploy (recommended)
git add .
git commit -m "Add IssueCapture"
git push

# Option 2: Vercel CLI
npm i -g vercel
vercel              # preview deploy
vercel --prod       # production deploy
```

### 5. Verify it works in production

Confirm the widget loaded on your deployed site

- Open your production URL in a fresh tab
- You should see the floating Report Issue button
- Open DevTools console and type `IssueCapture` — you should see the widget object (this distinguishes "script didn't load" from "ad blocker is hiding the button")
- Click the button, submit a test issue, and confirm it lands in Jira

### 6. Custom domain (optional)

Add a custom domain to your Vercel project

- Settings → Domains
- Vercel verifies ownership via your DNS records — exact values depend on your registrar
- After DNS propagates the SSL certificate is issued automatically (no manual cert step)
- Once the custom domain is live, add it to your IssueCapture Domains allowlist too

```bash
# Vercel → your project → Settings → Domains

# 1. Click "Add" and enter your domain
# 2. Follow Vercel's DNS instructions:
#    Apex (yourdomain.com):
#      A     @     76.76.21.21
#    www subdomain:
#      CNAME www   cname.vercel-dns.com

# 3. Wait for DNS to propagate (typically 5–60 minutes)
# 4. Vercel auto-issues a Let's Encrypt SSL certificate
```

## Troubleshooting

Common integration issues and how to solve them.

### Env vars set in Vercel but not reaching the browser

- Confirm the variable is added under Settings → Environment Variables (not under project Settings → General)
- Tick the "Production" scope — env vars are per-environment
- Trigger a fresh deploy after editing env vars (Vercel does NOT redeploy automatically)
- Use the right prefix for your bundler: NEXT_PUBLIC_ / VITE_ / REACT_APP_

### "Domain not allowed" on production (often shown as CORS in the console)

- In the IssueCapture dashboard, open your widget and click the Domains tab
- Add your Vercel hostname (e.g. your-app.vercel.app) and your custom domain if you have one
- Add both www and non-www if you serve both
- Preview deployments have their own hostnames: add the branch URL you test with (e.g. your-app-git-staging-your-team.vercel.app). Do not use `*.vercel.app`, which would allow every Vercel-hosted site

### Preview deployments can't submit issues

Each Vercel preview has a unique URL like your-app-git-feature-team.vercel.app

- Add that branch URL to the Domains allowlist. It stays the same for every deploy of that branch
- Per-deployment URLs change on every deploy, so add those only for one-off tests
- Or give the preview branch a stable custom domain (e.g. staging.yourdomain.com) and allow that domain

### Widget added in Edge Middleware or a Server Component never appears

The widget is a browser-only script — it must run on the client, not in Vercel’s Edge/Node server runtime.

- Don’t call IssueCapture from middleware.ts or an Edge Function — there’s no DOM there, so nothing renders
- In the Next.js App Router, initialize it from a Client Component ("use client") or the layout \<script> tag — not a Server Component
- Server-rendering the page is fine; just make sure the init code itself executes in the browser
- Quick check: if `typeof window === "undefined"` where your init runs, it’s on the server — move it client-side

### Custom domain isn't serving over HTTPS yet

- DNS needs to propagate before Vercel can issue the cert — 5 to 60 minutes is typical
- Verify the DNS records match exactly what Vercel showed you (A 76.76.21.21 for the apex, CNAME cname.vercel-dns.com for subdomains)
- Check Vercel Settings → Domains for the verification status — green check means the cert is live

---

[View this page on issuecapture.com](https://issuecapture.com/docs/install/vercel)
