workers-sdk
workers-sdk copied to clipboard
🐛 BUG: `ENOMEM: not enough memory` when attempting `wrangler pages publish <FOLDER>` in a virtual machine
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:

Using node v18.7.0 (npm v8.15.0)
Help?
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.
Hi,
thanks for following up; I ran the NODE_OPTIONS switch as above, but that resulted in the same error.
Are you running this on your own machine, or on some cloud machine? Can you try again with 8192 just to be absolutely sure?
I tried all the way up to 32768 but to no avail.
It's a VirtualBox machine on my own machine, with ample resources allocated.
Ah, that's maybe interesting. If you run this on your host machine, does it work?
Ubuntu machine causing the issue; host machine (Mac) working happily.
That's really useful information. Thank you! We'll dig into it and see if we can reproduce and find a fix.
This should already be fixed, let us know if you still have this issue!