RpcIpcMessagePortClosedError: Process 38 exited [SIGKILL].

Vvas3/26/2023
Hi, I'm deploying a ReactJS app, the build succeeds, it gets containerized and on deployment I get this error:
------------------------------------------------
> react-scripts start
(node:27) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(Use node --trace-deprecation ... to show where the warning was created)
(node:27) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
Starting the development server...
/app/node_modules/react-scripts/scripts/start.js:19
throw err;
^
RpcIpcMessagePortClosedError: Process 38 exited [SIGKILL].
at /app/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:19:23
at Generator.next (<anonymous>)
at /app/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:8:71
at new Promise (<anonymous>)
at __awaiter (/app/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:4:12)
at ChildProcess.handleExit (/app/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:18:42)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: null,
signal: 'SIGKILL'
---------------------------------

I've tried:
- checking all my dependencies and resetting them
- I was running node 18.5 and changed railway to 18.21 (highest it can go)
- changed my node to match to 18.21
- added webpack.config.js -> useTypeScriptIncrementalApi: false
- added --max_old_space_size=4096 as an ENV var, and to the start command
(also have legacy-peer-deps=true in .npmrc)
build=100s, publish=25s, deploy fails in 10s

all works fine on local and fails with this on railway. According to metrics, the most memory goes up to=450MB, and CPU is 20-25%, network in=35B, out=0B...

Does anyone have any idea?
Vvas3/26/2023
N/A
Bbrody3/26/2023
react-scripts start starts a development server and should never be used in production, you want to build your app then serve the built files with something like serve
Vvas3/26/2023
thanks for the tip, but can you expand on how it applies to the issue I've shared in terms of getting the server up?
Bbrody3/26/2023
the development server uses more ram than you are allocated on the free plan
Bbrody3/26/2023
thus it gets killed
Vvas3/26/2023
I see...
Bbrody3/26/2023
^
Bbrody3/26/2023
serve will use approximately 70-100mb depending on load
Vvas3/26/2023
according to the metrics it's now using 455MB (when crashing) -> isn't the allocation 4GB?
Bbrody3/26/2023
no free tier is 512mb
Vvas3/26/2023
right, thanks for this...and how much would you say the dev server uses?
Bbrody3/26/2023
it uses 455mb like you just said
Vvas3/26/2023
hahah well if I have 512, wouldn't that cover it? out of mem makes sense in terms of what I've seen out there for this error but just wondering...
Bbrody3/26/2023
455mb is dangerously close to 512mb so your app would get killed for a memory spike that might not even show up on the metrics
Bbrody3/26/2023
but you don't want to run the dev server on railway even if you had enough memory, can't stress that enough
Vvas3/26/2023
what's the main concern with that? (asking as my main concern right now is speed)
Bbrody3/26/2023
it would be speed, you are spot on
Bbrody3/26/2023
and memory, it could grow exponentially since it was already 455mb without any connections
Vvas3/26/2023
yeah...makes sense. Thanks a lot!
Bbrody3/26/2023
so look into getting your app built and then serving those static files with serve
Vvas3/26/2023
one last thing, how do I mark this as solved?
Bbrody3/26/2023
I can do that, dw
Vvas3/26/2023
thank you!
Bbrody3/26/2023
no problem!