serverless-nodejs-starter
serverless-nodejs-starter copied to clipboard
Yarn support
Tried to use your starter and encountered error:
Tims-MacBook-Pro:ethergas TrueCarry$ serverless deploy
Serverless: Bundling with Webpack...
Time: 664ms
Asset Size Chunks Chunk Names
handler.js 5.52 kB 0 [emitted] handler
handler.js.map 5.38 kB 0 [emitted] handler
[0] ./handler.js 2.35 kB {0} [built]
[1] external "babel-runtime/core-js/promise" 42 bytes {0} [not cacheable]
[2] external "babel-runtime/helpers/objectWithoutProperties" 42 bytes {0} [not cacheable]
[3] external "babel-runtime/regenerator" 42 bytes {0} [not cacheable]
[4] external "babel-runtime/core-js/json/stringify" 42 bytes {0} [not cacheable]
[5] external "babel-runtime/helpers/asyncToGenerator" 42 bytes {0} [not cacheable]
[6] external "source-map-support/register" 42 bytes {0} [not cacheable]
Syntax Error -------------------------------------------
Unexpected end of JSON input
Removing my node_modules and installing with npm helped. I don't know why it's broken for yarn, please take a look.
Steps to reproduce:
- Create project with template
- Run
yarn
- Run
serverless deploy
Tests and local invocations work fine.
@TrueCarry It's failing with this Error: Command failed: npm ls -prod -json -depth=1
.
It seems like serverless-webpack is using something specific for npm. Not sure what is going on.
Tried with serverless-webpack 4.2.0 and it somehow works.
@TrueCarry Oh weird. Thanks for letting me know. I'll update it.
@TrueCarry Just updated it. https://github.com/AnomalyInnovations/serverless-nodejs-starter/commit/4cc022d690b0c1de2cfea7d3d1ec6e7ac3437f46. Closing this.
Hello. Tried using your template again today, and it crashes with 'probably' same error. Not sure how to debug it.
Logs:
Tims-MacBook-Pro:telegraf-aws-test TrueCarry$ SLS_DEBUG=* sls deploy
Serverless: Load command run
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command emit
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command webpack
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Invoke webpack:validate
Serverless: Invoke webpack:compile
Serverless: Bundling with Webpack...
Time: 642ms
Asset Size Chunks Chunk Names
handler.js 4.98 kB 0 [emitted] handler
handler.js.map 5.44 kB 0 [emitted] handler
[0] ./handler.js 1.91 kB {0} [built]
[1] external "babel-runtime/regenerator" 42 bytes {0} [not cacheable]
[2] external "babel-runtime/helpers/asyncToGenerator" 42 bytes {0} [not cacheable]
[3] external "source-map-support/register" 42 bytes {0} [not cacheable]
[4] external "telegraf" 42 bytes {0} [not cacheable]
[5] external "telegraf-aws" 42 bytes {0} [not cacheable]
Serverless: Invoke webpack:package
Syntax Error -------------------------------------------
Unexpected end of JSON input
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
SyntaxError: Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at BbPromise.try (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/serverless-webpack/lib/packExternalModules.js:236:47)
at tryCatcher (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/method.js:39:29)
at BbPromise.fromCallback.then.depJson (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/serverless-webpack/lib/packExternalModules.js:236:35)
at tryCatcher (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/promise.js:638:18)
at /Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/bluebird/js/release/nodeback.js:42:21
at childProcess.exec (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/serverless-webpack/lib/packExternalModules.js:233:16)
at ChildProcess.exithandler (child_process.js:282:5)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:368:22)
at PluginManager.spawn (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:386:17)
at ServerlessWebpack.BbPromise.bind.then.then.then (/Users/TrueCarry/Documents/GitHub/telegraf-aws-test/node_modules/serverless-webpack/index.js:90:51)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: darwin
Node Version: 8.9.3
Serverless Version: 1.25.0
@jayair Can you re-open this?
@TrueCarry Sure. Which version of Serverless are you using?