CF worker with aws sdk limit exceeded

workers

#1

hi all.

i want to use cloudflare worker for upload some file to aws s3 with aws sdk javascript. i’m use https://github.com/detroitenglish/cloudflare-worker-webpack-boilerplate for building and deploy, i’m just require('aws-sdk'); but when i run npm run deploy this show error log
CF-Worker script size limit exceeded (1694KB) can someone help me?

thank you.


#2

I’m afraid the webpack file is turning up to over 1.7MB with that included. Maybe there is some webpack config that selectively includes parts of that module? (Not sure, my only experience with webpack is laravel mix).


#3

i have some test and success on nodejs, just require what we need.
// import entire SDK
//var AWS = require(‘aws-sdk’);
// import AWS object without services
var AWS = require(‘aws-sdk/global’);
// import individual service
var S3 = require(‘aws-sdk/clients/s3’);

building original js 650KB and 230KB minified. But i have new issue.
[code 10021]: Uncaught ReferenceError: global is not defined

i’m try to manual insert on worker editor, i’m try insert uncompressed javascript code for readable debug, and i’m get this error:

Uncaught ReferenceError: global is not defined at line 1609 at line 20 in __webpack_require__ at line 3620 at line 20 in __webpack_require__ at line 13350 at line 20 in __webpack_require__ at line 13302 at line 20 in __webpack_require__ at line 3426 at line 20 in __webpack_require__

maybe @detroitenglish or @KentonVarda @harris can help me.
thank you.