NodeJS application is serving EOF

I have a NodeJS application which works fine on Heroku, but I began moving it to Render today. At first, I was serving using http with express, but that would only serve a 404 error.

Then I realized that Render automatically provides HTTPS. At this point, I changed my express listener from app.listen(PORT) to https.createServer(app).listen(PORT).

I’m facing a new problem now: every request comes back with an EOF response.

My code is hosted here on GitHub and the code for the server is in /server/index.ts. I am so confused as to how this is not working because it works perfectly on my local machine.

Hi Viraj,

Thanks for reaching out.

I’m seeing some errors in your latest deploy logs that you might want to double-check:

.../bin/sh: 1: tsc: not found.../bin/sh: 1: react-scripts: not found...

You’ll need to ensure these are installed and referenced correctly.

Kind regards

Alan

The same thing is happening in my most recent build. The site is only responding with EOF.

Here is the build output:

Full logs:

Jul 10 07:47:25 PM   ==> Cloning from https://github.com/VirajShah21/JustData...
Jul 10 07:47:25 PM   ==> Checking out commit baa979adc9559f0f4df20d26c843344f516a55be in branch main
Jul 10 07:47:27 PM   ==> Downloading cache...
Jul 10 07:48:03 PM   ==> Downloaded 185MB in 28s. Extraction took 6s.
Jul 10 07:48:09 PM   ==> Running build command 'cd app; yarn; yarn build; cd ../server; yarn; yarn build;'...
Jul 10 07:48:09 PM   yarn install v1.22.5
Jul 10 07:48:09 PM   [1/4] Resolving packages...
Jul 10 07:48:10 PM   [2/4] Fetching packages...
Jul 10 07:48:11 PM   info fsevents@2.3.2: The platform "linux" is incompatible with this module.
Jul 10 07:48:11 PM   info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
Jul 10 07:48:11 PM   [3/4] Linking dependencies...
Jul 10 07:48:11 PM   warning " > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".
Jul 10 07:48:11 PM   warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
Jul 10 07:48:11 PM   warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
Jul 10 07:48:30 PM   [4/4] Building fresh packages...
Jul 10 07:48:31 PM   Done in 21.92s.
Jul 10 07:48:31 PM   yarn run v1.22.5
Jul 10 07:48:31 PM   $ react-scripts build
Jul 10 07:48:33 PM   Creating an optimized production build...
Jul 10 07:49:17 PM   Compiled with warnings.
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   [eslint]
Jul 10 07:49:17 PM   src/layout/JustFugitives/AllFugitivesList.tsx
Jul 10 07:49:17 PM     Line 58:8:  React Hook useEffect has missing dependencies: 'filter' and 'fugitives'. Either include them or remove the dependency array  react-hooks/exhaustive-deps
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   src/layout/JustPlaces/JustPlaces.tsx
Jul 10 07:49:17 PM     Line 1:10:  'IonIcon' is defined but never used  @typescript-eslint/no-unused-vars
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   Search for the keywords to learn more about each warning.
Jul 10 07:49:17 PM   To ignore, add // eslint-disable-next-line to the line before.
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   File sizes after gzip:
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM     144.24 kB  build/static/js/main.75f6710c.js
Jul 10 07:49:17 PM     27.47 kB   build/static/js/851.161c2a10.chunk.js
Jul 10 07:49:17 PM     4.47 kB    build/static/css/main.a9179451.css
Jul 10 07:49:17 PM     2.72 kB    build/static/js/372.6e3a44cf.chunk.js
Jul 10 07:49:17 PM     2.19 kB    build/static/js/858.a6b5582b.chunk.js
Jul 10 07:49:17 PM     2.19 kB    build/static/js/738.517f326e.chunk.js
Jul 10 07:49:17 PM     2.18 kB    build/static/js/186.49eccde7.chunk.js
Jul 10 07:49:17 PM     1.78 kB    build/static/js/787.c1112931.chunk.js
Jul 10 07:49:17 PM     972 B      build/static/js/344.41cbf025.chunk.js
Jul 10 07:49:17 PM     573 B      build/static/js/856.866ba81f.chunk.js
Jul 10 07:49:17 PM     508 B      build/static/js/22.0051f979.chunk.js
Jul 10 07:49:17 PM     489 B      build/static/js/841.84e36204.chunk.js
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   The project was built assuming it is hosted at /.
Jul 10 07:49:17 PM   You can control this with the homepage field in your package.json.
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   The build folder is ready to be deployed.
Jul 10 07:49:17 PM   You may serve it with a static server:
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM     yarn global add serve
Jul 10 07:49:17 PM     serve -s build
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   Find out more about deployment here:
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM     https://cra.link/deployment
Jul 10 07:49:17 PM  
Jul 10 07:49:17 PM   Done in 45.29s.
Jul 10 07:49:17 PM   yarn install v1.22.5
Jul 10 07:49:17 PM   [1/5] Validating package.json...
Jul 10 07:49:17 PM   [2/5] Resolving packages...
Jul 10 07:49:17 PM   [3/5] Fetching packages...
Jul 10 07:49:17 PM   [4/5] Linking dependencies...
Jul 10 07:49:19 PM   [5/5] Building fresh packages...
Jul 10 07:50:07 PM   Done in 49.98s.
Jul 10 07:50:07 PM   yarn run v1.22.5
Jul 10 07:50:07 PM   $ tsc
Jul 10 07:50:11 PM   Done in 4.09s.
Jul 10 07:50:11 PM   ==> Generating container image from build. This may take a few minutes...
Jul 10 07:54:36 PM   ==> Uploading build...
Jul 10 07:55:19 PM   ==> Build successful 🎉
Jul 10 07:55:19 PM   ==> Deploying...
Jul 10 07:56:55 PM  ==> Starting service with 'node server/build'
Jul 10 07:56:59 PM  2022-07-10T23:56:59.879Z [info]: Creating caches directory
Jul 10 07:56:59 PM  2022-07-10T23:56:59.882Z [info]: Launching a virtual Chrome instance...
Jul 10 07:56:59 PM  2022-07-10T23:56:59.885Z [info]: Server started at https://just-data.onrender.com

Web Service instances will only be receiving requests over HTTP, not HTTPS, could you try changing that? HTTPS/SSL is terminated before the HTTP request is sent to the running instance.

Alan

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