NodeJS 20 container failed on free tier

I have tried to upload a very small node app with typescript to
My app kept killed because Out of memory.
I have used node-alpine image, at the end, my whole app looks like this:

console.log(“hello world”)

devDependencies: typescript, @types/node


2023-09-19T09:59:59Z app[32871e9c092e48] ams [info]> tsc && node dist/index.js
2023-09-19T10:00:06Z app[32871e9c092e48] ams [info][    7.967209] Out of memory: Killed process 325 (node) total-vm:777652kB, anon-rss:127756kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:4236kB oom_score_adj:0

On my local machine the original whole app RSS consumed below 50 mbytes.
I am pretty sure, I could run these on a 128 mb GCP container.
Why can`t even host a hello world app?
What is the point of tier free tear if there is a massive memory leak?

Hi @Teddybee

I suspect the OOM happens during TS → JS translation phase. It would probably be a good idea to run Typescript compiler during the build phase (in Dockerfile) instead of during machine’s startup.

1 Like

Thank you, that helped. My app is now running, mem consumption is 60 mb.

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