workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: `ENOMEM: not enough memory` when attempting `wrangler pages publish <FOLDER>` in a virtual machine

Open synch-cc opened this issue 3 years ago • 8 comments

What version of Wrangler are you using?

2.0.26

What operating system are you using?

Linux (Ubuntu 22.04)

Describe the Bug

Hi,

trying to upload files via wranger to pages.

Invoking wrangler pages publish <DIRECTORY> gives the below error:

✘ [ERROR] ENOMEM: not enough memory, open '<FILENAME>'

The upload fails at this stage. I'm using an existing empty project, and have successfully initiated and linked to the CloudFlare account. There are 1407 files in a total of 318MB to upload.

The machine has 32GB memory available, and no changes to any environment have been made - yarn/npm/nvm are fresh out of the box installations and the OS is a fresh installation.

Memory usage is at 376MiB normally, 414MB when node is started, and it crashes with the ENOMEM error at 451MiB.

free -m: image

Using node v18.7.0 (npm v8.15.0)

Help?

synch-cc avatar Aug 18 '22 12:08 synch-cc

Hi!

Can you try running your wrangler command with the following environment variable?

NODE_OPTIONS=--max-old-space-size=4096 wrangler pages publish <directory>

This will try to override the amount of RAM that Node gets allocated.

GregBrimble avatar Aug 23 '22 14:08 GregBrimble

Hi,

thanks for following up; I ran the NODE_OPTIONS switch as above, but that resulted in the same error.

synch-cc avatar Aug 23 '22 14:08 synch-cc

Are you running this on your own machine, or on some cloud machine? Can you try again with 8192 just to be absolutely sure?

GregBrimble avatar Aug 23 '22 14:08 GregBrimble

I tried all the way up to 32768 but to no avail.

synch-cc avatar Aug 23 '22 14:08 synch-cc

It's a VirtualBox machine on my own machine, with ample resources allocated.

synch-cc avatar Aug 23 '22 14:08 synch-cc

Ah, that's maybe interesting. If you run this on your host machine, does it work?

GregBrimble avatar Aug 23 '22 15:08 GregBrimble

Ubuntu machine causing the issue; host machine (Mac) working happily.

synch-cc avatar Aug 29 '22 07:08 synch-cc

That's really useful information. Thank you! We'll dig into it and see if we can reproduce and find a fix.

GregBrimble avatar Aug 29 '22 21:08 GregBrimble

This should already be fixed, let us know if you still have this issue!

WalshyDev avatar Oct 19 '22 14:10 WalshyDev