Skip to content
Back

[SOLVED] JavaScript heap out of memory during build on Appwrite sites

  • 0
  • Resolved
  • 4
  • Self Hosted
  • Sites
deep
4 Dec, 2025, 15:11

I am running into heap out of memory when I am trying to build an Appwrite site. Usually this can be fixed by modifying the max-old-space-size configuration, but as far as I know, there is no way to do that in Appwrite sites.

Also the server usage is not a lot, it has a 16GB memory and less than 4GB memory is used by Appwrite even when building the site. Each core also has less than 10% usage.

I also checked the environment variables, and both _APP_COMPUTE_CPUS and _APP_COMPUTE_MEMORY are unrestricted.

TypeScript
[log] [nuxi] Nuxt 3.17.7 (with Nitro 2.12.9, Vite 6.4.1 and Vue 3.5.25)
[info] [nuxt:tailwindcss] Using default Tailwind CSS file
[info] [nuxi] Building for Nitro preset: `node-listener`
[info] Building client...
[info] vite v6.4.1 building for production...
[info] transforming...

<--- Last few GCs --->

[93:0x7f36a1c10000] 94416 ms: Mark-Compact 1010.2 (1043.2) -> 1002.6 (1043.7) MB, pooled: 0 MB, 1889.16 / 0.04 ms (average mu = 0.148, current mu = 0.137) allocation failure; scavenge might not succeed
[93:0x7f36a1c10000] 96338 ms: Mark-Compact 1009.7 (1043.7) -> 1003.4 (1044.2) MB, pooled: 0 MB, 1528.53 / 0.03 ms (average mu = 0.174, current mu = 0.205) task; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

bash: line 1: 82 Aborted (core dumped) npm run build
TL;DR
JavaScript heap out of memory issue during build on Appwrite sites but specifying server resources didn't work. Tried dynamic imports and no heavy dependencies. Team suggests checking API for container specs and discovered it was assigned a 512MB vcpu container causing the build failure. Solution: Updated container specification via the API which resolved the problem.
5 Dec, 2025, 08:10

Update: I remembered I can just set the NODE_OPTIONS in package.json , but that didn't help either because the process was killed

TypeScript
Run `npm audit` for details.

> build
> NODE_OPTIONS=--max-old-space-size=2048 nuxt build

[log] [nuxi] Nuxt 3.17.7 (with Nitro 2.12.9, Vite 6.4.1 and Vue 3.5.25)
[info] [nuxt:tailwindcss] Using default Tailwind CSS file
[info] [nuxi] Building for Nitro preset: `node-listener`
[info] Building client...
[info] vite v6.4.1 building for production...
[info] transforming...
[info] ✓ 2638 modules transformed.
[info] rendering chunks...
bash: line 1: 83 Killed npm run build
6 Dec, 2025, 09:11

Hey! <@802997747909001228> Have you resolved this?

6 Dec, 2025, 11:10

Hello <@1329045306997866509>, sorry no I wasn't able to find any solution for this yet

6 Dec, 2025, 11:10

I would really love some help

6 Dec, 2025, 11:22

Ok! First of all, tell me whether you've NODE_OPTIONS in your sites env or not?

6 Dec, 2025, 11:24

No, I do not have that in my sites env currently. Do you want me to try with that too?

6 Dec, 2025, 11:50

Yes please do that if you can. And set it's value as something like this - NODE_OPTIONS=--max-old-space-size=<memory-size-you-want>

6 Dec, 2025, 11:50

See if it works

6 Dec, 2025, 11:56

Unfortunately it didn't, I still get this weird process that kills the npm run build

TypeScript
> build
> NODE_OPTIONS=--max-old-space-size=2048 nuxt build

[log] [nuxi] Nuxt 3.17.7 (with Nitro 2.12.9, Vite 6.4.1 and Vue 3.5.25)
[info] [nuxt:tailwindcss] Using default Tailwind CSS file
[info] [nuxi] Building for Nitro preset: `node-listener`
[info] Building client...
[info] vite v6.4.1 building for production...
[info] transforming...
[info] ✓ 2638 modules transformed.
[info] rendering chunks...
bash: line 1: 85 Killed npm run build
6 Dec, 2025, 13:06

Can you show me your package.json? Do you've any heavy dependencies there?

6 Dec, 2025, 14:18

Sure, Here is my package.json. I don't see any heavy dependencies. Also the npm install succeeds on the server, it's just the npm run build that fails. Here are the full build logs

TypeScript
[11:35:27] [open-runtimes] Environment preparation started. 
[11:35:27] [open-runtimes] Environment preparation finished. 
[11:35:27] [open-runtimes] Build command execution started. 

> postinstall
> nuxt prepare

[info] [nuxt:tailwindcss] Using default Tailwind CSS file
[success] [nuxi] Types generated in .nuxt

added 1238 packages, and audited 1240 packages in 45s

243 packages are looking for funding
  run `npm fund` for details

2 vulnerabilities (1 low, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> build
> NODE_OPTIONS=--max-old-space-size=2048 nuxt build

[log] [nuxi] Nuxt 3.17.7 (with Nitro 2.12.9, Vite 6.4.1 and Vue 3.5.25)
[info] [nuxt:tailwindcss] Using default Tailwind CSS file
[info] [nuxi] Building for Nitro preset: `node-listener`
[info] Building client...
[info] vite v6.4.1 building for production...
[info] transforming...
[info] ✓ 2638 modules transformed.
[info] rendering chunks...
bash: line 1:    85 Killed                  npm run build
6 Dec, 2025, 14:44

Try using dynamic imports for your chart libraries as you've so many. Also, remove those you're not using. That too could be the possible issue behind build failure

6 Dec, 2025, 17:47

I tried removing unused libraries and I still get the same error. Is there no way to allow Appwrite to use more resources like RAM or CPU? It's not like I am maxing out on server usage. What is killing the npm run build?

6 Dec, 2025, 18:38

Are you using any container? Like docker or something?

8 Dec, 2025, 06:49

Other than Appwrite itself, there is no other docker container on the server.

8 Dec, 2025, 06:49

Is that what you meant?

8 Dec, 2025, 07:01

Yes

8 Dec, 2025, 07:02

<@802997747909001228> Then as per what I know, you can try to build locally and upload a manual deployment. Maybe then it'll work?

8 Dec, 2025, 07:06

Of course that will work but that wouldn't that pretty much defeat the point of Appwrite sites? I was using Appwrite sites so I do not have to manually write entire CD pipelines

8 Dec, 2025, 07:07

I want to understand what's causing the build to fail on the server even though I have provided unrestricted compute and the resource consumption is nowhere near max

8 Dec, 2025, 07:18

Ok. Then let's ask someone from team instead of making any false assumptions

8 Dec, 2025, 07:18

<@462046107556511744> can you help us with this?

8 Dec, 2025, 18:55

so i don't think the cpu and memory are being applied. Can you look at the network logs in your browser and look for the list sites or get site API call's response body?

8 Dec, 2025, 18:56

something like /sites or /sites/:id

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more