Deploying base/default Remix App to Fly.io throws 502 error

Topic summary

A developer encountered a 502 error when deploying a Shopify Remix app to Fly.io, despite following official Shopify documentation. The Fly.io logs indicated the instance refused connection, suggesting the app wasn’t listening on 0.0.0.0:3000.

Initial troubleshooting:

  • Modified remix.config.js to add host: "0.0.0.0" in the dev configuration
  • Adjusted HOST and SHOPIFY_APP_URL environment variables
  • App worked correctly in local development environment

Resolution:
The original poster resolved the issue and posted the solution on the Fly.io community forum (link provided). However, the specific fix details weren’t shared in this thread.

Current status:
Another developer is experiencing the identical problem and has requested details about the solution, indicating this may be a common deployment issue with the Shopify Remix + Fly.io stack.

Summarized with AI on October 25. AI used: claude-sonnet-4-5-20250929.

I followed the documentation that SHOPIFY has put for Fly.io.
Before this step, I verified that I successfully installed my Shopify Remix App to my dev store, and I’m able to preview it. After running fly deploy, the url provided to view my “newly deployed app” takes me to a HTTP 502 Error page stating "xxx.fly.dev is currently unable to handle this request. "

The logs in my Fly.io dashboard has stated “ewr [error] [PC01] instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)” but I already added a host property to my remix.config.js thinking that would solve the problem:

// Corrected: Replace HOST with SHOPIFY_APP_URL to prevent conflicts
if (
  process.env.HOST &&
  (!process.env.SHOPIFY_APP_URL ||
    process.env.SHOPIFY_APP_URL === process.env.HOST)
) {
  process.env.SHOPIFY_APP_URL = process.env.HOST;
  delete process.env.HOST;
}

/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
  ignoredRouteFiles: ["**/.*"],
  appDirectory: "app",
  serverModuleFormat: "cjs",
  dev: { 
    port: process.env.PORT || 3000,   // Ensure the dev server uses the correct port
    host: "0.0.0.0"                   // Add this line to specify the host
  },
  future: {},
};

I don’t understand why I should be running into any errors granted I followed Shopify’s documentation word for word. If there’s anybody who has also experienced this issue could you please point me into the right direction? thank you

I managed to resolve this issue and added the solution I found in a Fly.io post:
https://community.fly.io/t/deploying-base-default-remix-app-to-fly-io-throws-502-error/22169
Hope this helps

Hi @aidendev

I also facing with the same issue without way to fix. Could you please share your way to resolved?