WARNING The app is not listening on the expected address and will not be reachable by fly-proxy

Hello. I was trying to deploy my Remix app for hours and keep failing. My app is running on 0.0.0.0:3000 (according to this docs (@remix-run/serve | Remix) I can configure the host and port by setting env variables):

...
ENV HOST="0.0.0.0"
ENV PORT="3000"
CMD [ "npm", "run", "start" ]

But whenever I try to deploy the app, running fly launch and fly deploy, I keep getting the following warning:

`WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:

  • 0.0.0.0:3000`

Here are my fly.toml and Dockerfile:

# fly.toml app configuration file generated for epic-esports on 2023-12-17T06:12:04+02:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "epic-esports"
primary_region = "ams"

[build]

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ["app"]

[[vm]]
  cpu_kind = "shared"
  cpus = 1
  memory_mb = 1024
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.18.2
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="Remix/Prisma"

# Remix/Prisma app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
    apt-get install -y build-essential openssl pkg-config python-is-python3

# Install node modules
COPY --link package-lock.json package.json ./
RUN npm ci --include=dev --legacy-peer-deps

# Generate Prisma Client
COPY --link prisma .
RUN npx prisma generate

# Copy application code
COPY --link . .

# Build application
RUN npm run build

# Remove development dependencies
RUN npm prune --omit=dev --legacy-peer-deps


# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y openssl sqlite3 && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built application
COPY --from=build /app /app

# Setup sqlite3 on a separate volume
RUN mkdir -p /data
VOLUME /data

# add shortcut for connecting to database CLI
RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli

# Entrypoint prepares the database.
ENTRYPOINT [ "/app/other/docker-entrypoint.js" ]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
ENV DATABASE_URL="file:///data/sqlite.db"
ENV HOST="0.0.0.0"
ENV PORT="3000"
CMD [ "npm", "run", "start" ]

A common cause for your app not listening on the correct port is that your app did not start. The place to look is your logs. Try running fly logs in one window and deploy your server in another.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.