Worker size-limit a problem?


#1

I just hit the 1MB limit by adding the “request” package, which is required by quite a lot of node-js package ~40k packages - starting to think that for advanced apps - cloudflare workers won’t save much time since we’ll need to write our own libraries…

Maybe Cloudflare can include some standard packages by default?

Update: I’m assuming someone will say “But you can use the new easier ES6 .fetch() API”, sure - but then i still can’t use battle-tested parsers like node-soap that depend on the “request” package for all requests.


#2

Adding a minification step to your build process can be a good way to get around the 1MB limit.


#3

That is a single dependency, packed with webpack.


#4

Yep, I understand! Are you running it with the minification option?


#5

Yes, the “production” mode.


#6

It’s really impressive that a single library is hitting the limit, I can only imagine how much unused code it is including. Is there perhaps a similar option which was designed to work in the browser rather than Node? They tend to be significantly smaller.


#7

Yes there is, Needle is much faster, smaller, better, easier also handles XML. But there’s no SOAP library that use it and very few other “libraries” that do, they seem to gather around request package.


#8

This is a very annoying part of javascript, it’s too bad it can’t be removed when minifying.


#9

Sadly, I have the same issue here after trying use aws-sdk to integrate with lambda, any suggestions? thank you.


Update.

Saved my own ass by importing individual services, such as:
var Lambda = require(‘aws-sdk/clients/lambda’);