doapp-ryanp / serverless-plugin-browserify Goto Github PK
View Code? Open in Web Editor NEWSpeed up your node based lambda's
License: MIT License
Speed up your node based lambda's
License: MIT License
I realize I can do this from the command line, but it would be helpful if I could also set the output dir in the serverless.yml file to make my command line simpler.
The reason I want to change it from the default is because I want to keep output in my project folder and not in tmp where it might collide with something else.
Note says that you're awaiting the merge of a certain PR, but I think it's been merged already?
Error happening with a mix of functions containing function level package and some without it.
Type Error ---------------------------------------------
Cannot read property 'length' of undefined For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
TypeError: Cannot read property 'length' of undefined
at GlobAll.globNext (C:\git\my-module\node_modules\glob-all\glob-all.js:84:20)
at GlobAll.run (C:\git\my-module\node_modules\glob-all\glob-all.js:78:8)
at Function.globAll.sync (C:\git\my-module\node_modules\glob-all\glob-all.js:192:41)
at BbPromise (C:\git\my-module\node_modules\serverless-plugin-browserify\lib\bundle.js:32:31)
at SlsBrowserify.bundle (C:\git\my-module\node_modules\serverless-plugin-browserify\lib\bundle.js:31:12)
I am requiring a module provision-dynamodb in my serverless project (in which I'm one of the authors, so I can make changes to that module, if needed). Execution in lambda fails.
This is my lambda function:
const processConfigTables = require('provision-dynamodb');
export const hello = async (event: Object, context: Object, callback: Function) : any => {
try {
const result = await processConfigTables([{
"name":"test-table",
"readStrategy": {
"name":"capacity-ratio",
"upperThresholdRatio":0.8,
"lowerThresholdRatio":0.15,
"incrementRatio":3,
"decrementRatio":0.8,
"lowerBoundUnit":1,
"upperBoundUnit":28},
"writeStrategy": {
"name":"capacity-ratio",
"upperThresholdRatio":0.8,
"lowerThresholdRatio":0.15,
"incrementRatio":3,
"decrementRatio":0.8,
"lowerBoundUnit":1,
"upperBoundUnit":28
}
}]);
console.log('result = ', result);
const response = {
statusCode: 200,
body: JSON.stringify({ok: true}),
};
return callback(null, response);
} catch (err) {
console.error('err', err);
return callback(null, {
statusCode: 500,
body: JSON.stringify(err),
});
}
};
I got this error:
module initialization error: Error
at Error (native)
at Object.fs.readdirSync (fs.js:808:18)
at Object.<anonymous> (/var/task/handler.js:3177:4)
at Object.96.../package.json (/var/task/handler.js:3197:4)
at s (/var/task/handler.js:1:682)
at /var/task/handler.js:1:733
at Object.102.nconf (/var/task/handler.js:4220:142)
at s (/var/task/handler.js:1:682)
at /var/task/handler.js:1:733
at Object.105../config (/var/task/handler.js:4229:519)
Hi!
Looks like this project has been abandoned; if you need something similar, I have forked and published a new version to npm
.
Search for serverless-plugin-browserifier.
I have installed your plugin, enabled it in my serverless.yml. I have not used any custom configuration and this happens on deployment:
Serverless: SlsBrowserify::validate
Serverless: SlsBrowserify::globalConfig
Type Error ---------------------------------------------
Cannot read property 'browserify' of undefined
For debugging logs, run again after setting SLS_DEBUG env var.
Stack Trace --------------------------------------------
TypeError: Cannot read property 'browserify' of undefined
at SlsBrowserify.globalConfig (/usr/local/lib/node_modules/serverless-plugin-browserify/lib/configure.js:15:56)
at SlsBrowserify.tryCatcher (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:510:31)
at Promise._settlePromise (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/promise.js:691:18)
at Async._drainQueue (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/async.js:138:16)
at Async._drainQueues (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/async.js:148:10)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/serverless-plugin-browserify/node_modules/bluebird/js/release/async.js:17:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Please report this error. We think it might be a bug.
Your Environment Information -----------------------------
OS: linux
Node Version: 4.2.6
Serverless Version: 1.1.0
As you said in readme "For most use cases you should NOT need to do any configuration." I didn't change any configuration. Should I?
It builds each function that I have specified in serverless.yml but in the end, it throws the following error:
EEXIST: file already exists, symlink '../JSONStream/bin.js' -> '/tmp/warnings/node_modules/.bin/JSONStream'
When I view the browserfied lambda file on AWS I get this Warning:
This function contains external libraries. Uploading a new file will override these libraries.
The function seems to work correctly as all dependencies are within the single file. But I'm wondering what is triggering this warning?
When using googleapis
npm package along with browserify, I get an "ENOENT: no such file or directory, scandir '/apis'
" error during execution.
I have been able to make browserify ignore googleapis
, but I can't come up with a way to make browserify/serverless to include the full googleapis
module.
There is any way to do this that I have been unable to find, or this is one case where having package.include
would really be the only solution?
When trying to use serverless deploy
with the browserify plugin added I'll get the following error:
Error: EEXIST: file already exists, mkdir '/var/folders/4w/_0f5wg2145z8vp3jbq56fzlm0000gn/T/locationCreate'
I looked into the '/var/folders/4w/_0f5wg2145z8vp3jbq56fzlm0000gn/T/ folder during execution and the folders are created when the "Bundling ... with Browserify" output happens. It takes some time and and then the error pops up.
Currently I'm using Serverless 1.2.0.
Here is the complete output:
serverless deploy
Serverless: Bundling locationCreate with Browserify...
Serverless: Bundling locationSendToClient with Browserify...
Serverless: Bundling locationCallback with Browserify...
Serverless: Bundling locationGetFull with Browserify...
Serverless: Bundling locationGetMetadata with Browserify...
Serverless: Bundling locationUpdate with Browserify...
fs.js:922
return binding.mkdir(pathModule._makeLong(path),
^
Error: EEXIST: file already exists, mkdir '/var/folders/4w/_0f5wg2145z8vp3jbq56fzlm0000gn/T/locationCreate'
at Error (native)
at Object.fs.mkdirSync (fs.js:922:18)
at b.bundle (/Users/simonjentsch/Documents/.../.../node_modules/serverless-plugin-browserify/lib/bundle.js:39:12)
at /Users/simonjentsch/Documents/.../.../node_modules/browserify/index.js:779:13
at ConcatStream.<anonymous> (/Users/simonjentsch/Documents/.../.../node_modules/browserify/node_modules/concat-stream/index.js:36:43)
at emitNone (events.js:91:20)
at ConcatStream.emit (events.js:185:7)
at finishMaybe (/Users/simonjentsch/Documents/.../.../node_modules/browserify/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:475:14)
at endWritable (/Users/simonjentsch/Documents/.../.../node_modules/browserify/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:485:3)
at ConcatStream.Writable.end (/Users/simonjentsch/Documents/.../.../node_modules/browserify/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:455:41)
at Readable.onend (/Users/simonjentsch/Documents/.../.../node_modules/read-only-stream/node_modules/readable-stream/lib/_stream_readable.js:504:10)
at Readable.g (events.js:291:16)
at emitNone (events.js:86:13)
at Readable.emit (events.js:185:7)
at endReadableNT (/Users/simonjentsch/Documents/.../.../node_modules/read-only-stream/node_modules/readable-stream/lib/_stream_readable.js:926:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
At least in Windows, when using a handler path that is more than one folder deep, the plugin throws an error.
Hi,
I'm getting this error since I installed serverless-plugin-browserify:
Serverless Error ---------------------------------------
Your socket connection to the server was not read from
or written to within the timeout period. Idle connections
will be closed.
Maybe it is related to amazon sdk timeout value so I raised aws tiemout by doing export AWS_CLIENT_TIMEOUT=900000 (before it was export AWS_CLIENT_TIMEOUT=300000) but i'm still having the same issue.
My previous deploy script was perfoming: npm --prune production before sls deploy... but I had to remove it because the plugin is installed in dev dependencies and it was not found.
It seems the size produced by the plugin is higher than performing a npm --prune production but I can't find where are located the zip files that the plugin generates.
With my previous configuration my project was 12.09 MB and my functions are not separated individually (although I used the "individually: true" as stated in the plugin readme)
How can I check if the zips using the plugin are greater than my previous setup?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.