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

Solved

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

aidendev
Shopify Partner
51 1 0

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

Accepted Solution (1)

aidendev
Shopify Partner
51 1 0

This is an accepted solution.

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

View solution in original post

Reply 1 (1)

aidendev
Shopify Partner
51 1 0

This is an accepted solution.

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