Dockerized Express web service gives 404

I am experimenting with Render.
I have dockerized the quickstart express-hello-world server, and have created a web service to deploy that. It does the docker build correctly, and launches the server correctly on docker port 3001. I assume Render magically maps that to port 443, but when I go to the xxx.onrender.com link I get a 404 error. Not sure what I am doing wrong. Below is my Dockerfile.

FROM node:18-alpine3.16
RUN apk add --no-cache openvpn

# So render can identify the port to map to
ENV PORT=3001
# Set working directory and copy source there
WORKDIR /home/node
COPY ./ /home/node
USER node

# Build the app
RUN yarn
# Run the app
CMD [ "npm", "start" ]

and this is the tail end of the log:

Jun 20 02:18:45 PM  > express-hello-world@1.0.0 start
Jun 20 02:18:45 PM  > node app.js
Jun 20 02:18:45 PM  
Jun 20 02:18:48 PM  Example app listening on port 3001!

I came back after an hour and the app was spun down (on free level). I hit the link again, it spun up and this time it worked, once. But when I reloaded the page or tried going from the Dashboard link again, I got the 404 again.

So it seems like it can work, but the “magic render glue” is not stable?

I’m having a very similar issue with just a base Node/Express web service. I get a 404 when hitting the xxx.onrender.com link, and a timeout when I append the port the server is actually running on (10000).

I have also found that doing a Hard Reload (e.g. Ctrl-Reload on Chrome) yields a higher success rate, maybe 50% with a large variance.

After reading another post I tried deploying the app to Oregon, and once it got started I have had no problems - no more 404.

I went back to the Ohio app and at first I thought it was working too, but then it reverted to the previous behavior where I get 404 most of the time, except when I try hard reload sometimes it works. But Oregon still ok.

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