技能 编程开发 Shopify应用生产环境部署指南

Shopify应用生产环境部署指南

v20260423
shopify-deploy-integration
本指南详细介绍了将Shopify应用(包括扩展和功能)部署到生产环境各大云平台(如Vercel、Fly.io、Google Cloud Run)的完整流程。内容涵盖了环境配置、Webhook设置、使用Shopify CLI发布扩展程序,以及处理API密钥和秘密凭证的最佳实践,确保应用在实际电商环境中稳定运行。
获取技能
157 次下载
概览

Shopify Deploy Integration

Overview

Deploy Shopify apps to popular hosting platforms. Covers environment configuration, webhook URL setup, and Shopify CLI deployment for extensions.

Prerequisites

  • Shopify app tested locally with shopify app dev
  • Platform CLI installed (vercel, fly, or gcloud)
  • Production API credentials ready
  • shopify.app.toml configured

Instructions

Step 1: Deploy App with Shopify CLI

# Shopify CLI handles extension deployment and app config sync
shopify app deploy

# This uploads:
# - Theme app extensions
# - Function extensions
# - App configuration (URLs, scopes, webhooks)
# But NOT your web app — you host that separately

Step 2: Vercel Deployment

Set environment variables, configure vercel.json for webhooks and function timeouts, and update shopify.app.toml with the Vercel URL.

See Vercel Deployment for the complete configuration.

Step 3: Fly.io Deployment

Configure fly.toml with health checks and min-machines, set secrets via fly secrets set, and deploy.

See Fly.io Deployment for the complete configuration.

Step 4: Google Cloud Run Deployment

Use a multi-stage Dockerfile for minimal image size, deploy with gcloud run deploy, and configure secrets via Secret Manager.

See Cloud Run Deployment for Dockerfile and deploy commands.

Step 5: Post-Deploy Verification

Run health checks, verify webhook endpoints return 401 (no HMAC), test OAuth start, and sync app config.

See Post-Deploy Verification for the complete verification script.

Output

  • App deployed to production hosting
  • Environment variables securely configured
  • Webhook endpoints accessible via HTTPS
  • Health check passing
  • App URLs synced to Shopify Partner Dashboard

Error Handling

IssueCauseSolution
OAuth redirect mismatchApp URL not updatedUpdate redirect_urls in shopify.app.toml and deploy
Webhooks not receivedURL not HTTPS or unreachableVerify public URL, check DNS
Cold start timeoutServerless function slowSet min instances to 1
CSP frame-ancestors errorMissing headerAdd CSP header for *.myshopify.com
shopify app deploy failsCLI token invalidRegenerate at partners.shopify.com

Examples

Environment Variable Checklist

# Required for all deployments:
SHOPIFY_API_KEY=           # From Partner Dashboard
SHOPIFY_API_SECRET=        # From Partner Dashboard
SHOPIFY_SCOPES=            # e.g., "read_products,write_products"
SHOPIFY_APP_URL=           # Your deployed app URL

# For custom/private apps:
SHOPIFY_ACCESS_TOKEN=      # shpat_xxx

# Optional:
SHOPIFY_API_VERSION=       # Default: latest stable. Update quarterly — see shopify.dev/docs/api/usage/versioning
SESSION_SECRET=            # For cookie signing
DATABASE_URL=              # Session storage

Resources

信息
分类 编程开发
名称 shopify-deploy-integration
版本 v20260423
大小 4.41KB
更新时间 2026-09-06
语言