Hello,
given that I ran out of alternatives on how to fix this issue, I thought it would be valuable to raise the topic here.
I simply can’t reach a simple Node hello world express app either through HTTP or HTTPS.
Deployment and release are successful. The health check is also green.
Logs:
2022-12-26T06:46:44.278 runner[1e3cc136] fra [info] Starting instance
2022-12-26T06:46:46.163 runner[1e3cc136] fra [info] Configuring virtual machine
2022-12-26T06:46:46.164 runner[1e3cc136] fra [info] Pulling container image
2022-12-26T06:46:48.003 runner[1e3cc136] fra [info] Unpacking image
2022-12-26T06:46:48.720 runner[1e3cc136] fra [info] Preparing kernel init
2022-12-26T06:46:49.023 runner[1e3cc136] fra [info] Configuring firecracker
2022-12-26T06:46:49.124 runner[1e3cc136] fra [info] Starting virtual machine
2022-12-26T06:46:49.407 app[1e3cc136] fra [info] Starting init (commit: f447594)...
2022-12-26T06:46:49.438 app[1e3cc136] fra [info] Preparing to run: `docker-entrypoint.sh node dist/index.js` as root
2022-12-26T06:46:49.458 app[1e3cc136] fra [info] 2022/12/26 06:46:49 listening on <IP6_OMMITED> (DNS: [fdaa::3]:53)
2022-12-26T06:46:49.928 app[1e3cc136] fra [info] ⚡️[server]: Server is running at https://0.0.0.0:8080
TOML file:
app = <APP_NAME_OMMITED>
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
HOST = "0.0.0.0"
PORT = "8080"
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
App source code:
import express from 'express';
import type { Request, Response } from 'express';
const app = express();
const HOST = process.env.HOST ?? 'localhost';
const PORT = process.env.PORT ?? 3000;
app.get('/', (req: Request, res: Response) => {
res.send('Express + TypeScript server');
});
app.listen(Number(PORT), HOST, () => {
console.log(`⚡️[server]: Server is running at https://${HOST}:${PORT}`);
});
Dockerfile
FROM node:16-alpine AS deps
WORKDIR /app
COPY package.json yarn.lock* ./
RUN yarn install --production=true --frozen-lockfile
RUN yarn autoclean --force
COPY . .
FROM node:16-alpine AS builder
WORKDIR /app
COPY . .
RUN yarn --frozen-lockfile
RUN yarn build
FROM node:16-alpine AS runner
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
EXPOSE 8080
CMD ["node", "dist/index.js"]
- I’ve checked different base image (slim) to see if it was a problem with alpine but no luck;
- I’ve carefully checked if port 8080 is being exposed correctly;
- I’ve explicitly used 0.0.0.0 as host but no luck;
- I’ve tried to remove HTTPS and make it HTTP-only but no luck;
- I’ve tried to follow the troubleshoot article from docs but no luck;
- I’ve tried to see if there was any substantial difference between my code and the Hellonode example that fly.io uses but I didn’t find anything;
I’m out of options =D Perhaps you guys see anything that I’m not seeing?