The "Just Change Dev to Prod" Disaster
My first prod deploy broke during a busy sales day. The client was pissed. Turns out you can't just run shopify app dev
pointed at production - learned that after watching error logs for 4 straight hours.
Here's what broke when I tried the obvious approach:
What seemed logical:
## Seemed reasonable at 2am
shopify app dev --store=production-store.myshopify.com
## Spoiler: dev server != production deployment
What actually exploded:
- Development tunneling tried to connect to production URLs
- Interactive authentication prompts hung the deployment forever
- SQLite database got wiped on every restart
- Environment variables were mixed between dev and prod
- SSL certificates were completely fucked
TOML Files Will Ruin Your Day
Shopify CLI 3.x uses TOML files for configuration, and they're more finicky than the docs let on.
This breaks in production (learned the hard way):
## shopify.app.prod.toml - DON'T DO THIS
application_url = "http://localhost:3000" # Whoops
This actually works:
## shopify.app.prod.toml
name = "your-app"
client_id = "your_client_id"
application_url = "https://your-actual-domain.com"
[build]
automatically_update_urls_on_dev = false # CRITICAL for production
[app_proxy]
url = "https://your-actual-domain.com/api/proxy"
The application_url
has to match exactly. Burned 6 hours debugging auth loops because my TOML had https://app.example.com
but I deployed to https://example-app.herokuapp.com
. Shopify's TOML docs mention this but it's buried in paragraph 3.
Authentication Tokens: Expiry Hell at 2AM
Development uses interactive OAuth. Production needs CLI tokens. These tokens expire, and they'll do it at the worst possible moment.
Generate tokens in the Partner Dashboard under Settings > CLI Tokens. The CLI auth docs explain this but miss the expiry gotchas.
Token reality:
- They expire without warning (usually 60-90 days based on GitHub issues)
- Max 2 active tokens per Partner account
- Failed deploys just say "Authentication failed" - zero context
- No expiry date shown in the dashboard
Set this environment variable:
export SHOPIFY_CLI_PARTNERS_TOKEN="your_token_here"
Pro tip: Set up token expiry monitoring. I learned this after a deployment failed because the token expired at the worst possible moment.
The --force Flag Is Not Optional
The --force
flag isn't a suggestion - it's mandatory for non-interactive deployments:
shopify app deploy --config=prod --force
Without --force
, the CLI waits for interactive confirmation that'll never come in CI/CD. Your pipeline hangs for 10 minutes then times out. Yeah, I learned this the hard way at 11pm on a Friday.