{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/696","repository_url":"https://api.github.com/repos/aws/aws-sdk-js","labels_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/696/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/696/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/696/events","html_url":"https://github.com/aws/aws-sdk-js/issues/696","id":103730507,"number":696,"title":"browserify not working for node apps","user":{"login":"doapp-ryanp","id":1036546,"avatar_url":"https://avatars.githubusercontent.com/u/1036546?v=3","gravatar_id":"","url":"https://api.github.com/users/doapp-ryanp","html_url":"https://github.com/doapp-ryanp","followers_url":"https://api.github.com/users/doapp-ryanp/followers","following_url":"https://api.github.com/users/doapp-ryanp/following{/other_user}","gists_url":"https://api.github.com/users/doapp-ryanp/gists{/gist_id}","starred_url":"https://api.github.com/users/doapp-ryanp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doapp-ryanp/subscriptions","organizations_url":"https://api.github.com/users/doapp-ryanp/orgs","repos_url":"https://api.github.com/users/doapp-ryanp/repos","events_url":"https://api.github.com/users/doapp-ryanp/events{/privacy}","received_events_url":"https://api.github.com/users/doapp-ryanp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aws/aws-sdk-js/labels/Closing%20Soon%20-%20Feedback%20Requested","name":"Closing Soon - Feedback Requested","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-08-28T14:39:25Z","updated_at":"2016-04-08T20:54:49Z","closed_at":"2016-04-08T20:54:49Z","body":"Trying to browserify my node code for use in lambda to help combat the cold start issues (which also raises the ceiling on the hard 50MB zipped limit).\r\n\r\nIs [browserfying](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/browser-building.html) for node not supported?  Ultamately I'd like to just use the `--node` browserify option, but its not working.\r\n\r\nEx: (I wont be hard coding creds, this is just for ease of reproduce.)\r\n```javascript\r\nvar AWS = require('aws-sdk');\r\nAWS.config.update({\r\n  accessKeyId: 'mykey',\r\n  secretAccessKey: 'mysecret'\r\n});\r\nvar s3 = new AWS.S3();\r\ns3.listBuckets(function(err, data) {\r\n  console.log(err, data);\r\n});\r\n```\r\n\r\nIf I run `browserify bundletests.js > bundled.js` then run `node bundle.js` I get `XMLHttpRequest is not defined` which is expected since I'm not running in the browser.\r\n\r\nSo I run `browserify bundletests.js --dg --no-builtins --no-commondir > bundled.js` to not use the builtins and I get \r\n```\r\nmodule.js:340\r\n    throw err;\r\n          ^\r\nError: Cannot find module '_process'\r\n    at Function.Module._resolveFilename (module.js:338:15)\r\n    at Function.Module._load (module.js:280:25)\r\n    at Module.require (module.js:364:17)\r\n    at require (module.js:380:17)\r\n    at s (/Users/ryan/projects/JAWS/tests/bundle/testapp/myLambda/bundled.js:1:176)\r\n```\r\n\r\nAny ideas?"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/comments/207602895","html_url":"https://github.com/aws/aws-sdk-js/issues/696#issuecomment-207602895","issue_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/696","id":207602895,"user":{"login":"LiuJoyceC","id":12114318,"avatar_url":"https://avatars.githubusercontent.com/u/12114318?v=3","gravatar_id":"","url":"https://api.github.com/users/LiuJoyceC","html_url":"https://github.com/LiuJoyceC","followers_url":"https://api.github.com/users/LiuJoyceC/followers","following_url":"https://api.github.com/users/LiuJoyceC/following{/other_user}","gists_url":"https://api.github.com/users/LiuJoyceC/gists{/gist_id}","starred_url":"https://api.github.com/users/LiuJoyceC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiuJoyceC/subscriptions","organizations_url":"https://api.github.com/users/LiuJoyceC/orgs","repos_url":"https://api.github.com/users/LiuJoyceC/repos","events_url":"https://api.github.com/users/LiuJoyceC/events{/privacy}","received_events_url":"https://api.github.com/users/LiuJoyceC/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T20:54:49Z","updated_at":"2016-04-08T20:54:49Z","body":"If you still would like to bundle the latest version of the SDK to use in Lambda and not use the default version of the SDK pre-installed in Lambda, you can zip your directory that contains both the code for your Lambda function and a `node_modules` folder that contains your desired version of the SDK. Then your `require('aws-sdk')` in your code should reference the `aws-sdk` module in your zip rather than the the pre-installed version in Lambda.\r\nFor more info: http://docs.aws.amazon.com/lambda/latest/dg/nodejs-create-deployment-pkg.html\r\n\r\nIf file size is a concern, there are folders and files you can delete from `aws-sdk` before you zip it. In the root `aws-sdk` folder, you can safely delete the `dist`, `dist-tools`, and `scripts` folders without affecting your code. If you are only using a few AWS services in your code, you can also delete most of the files in `apis` as well. However, if you delete the api files for a service (or a version of a service) you don't use, be sure to remove the service or version from `apis/metadata.json`, or an error will be thrown when you run your code. If you are not making use of waiters or paginators in your code, you can also delete those files in `apis`. Deleting these folders and files will cut down the SDK's size by over 4MB (the entire SDK is over 7MB)."}}