I’m experiencing a persistent 502 Bad Gateway error when trying to access my Shopify app through the admin panel. The error message states: “Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared.”
The app works perfectly when accessed directly via http://localhost``:PORT, but fails when accessed through the Shopify admin panel via the tunnel.
My Setup
- Framework: React Router (Shopify App Template)
- Node Version: >=20.19
- Shopify CLI: Latest version
- Tunnel Service: ngrok (also tried Cloudflare tunnel)
- OS: Windows 10/11
- App Type: Embedded app
=======
Error Details
The app shows:
- 502 Bad Gateway
- “Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared”
What I’ve Verified
Local Server Works: The app loads correctly at http://localhost:PORT
Server is Running: The dev server starts successfully
Port is Accessible: Verified port 3000 is not blocked
Environment Variables: All required env vars are set (SHOPIFY_API_KEY, SHOPIFY_API_SECRET, etc.)
Database Connection: Prisma connection works fine
Import Paths: Fixed all ES module import paths with .js extensions
Dependencies: All packages installed correctly (@shopify/polaris, etc.)==- The app uses React Router with server-side rendering
-
Using Prisma for database (SQLite in development)
-
All routes are properly configured with authentication
-
The error occurs specifically when Shopify tries to load the embedded app iframe## Environment
-
OS: Windows 10/11
-
Node: v20.19+ or v22.12+
-
Package Manager: npm
-
Tunnel: ngrok (free tier) / Shopify CLI default tunnel
Any help or guidance would be greatly appreciated! Thank you in advance.
