serverless / serverless/examples

serverless-single-page-app-plugin TypeError: Cannot read property 'toString' of null

Open
#510 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.5k
Forks
4.4k
Avg merge
2h 55m
Merged PRs (30d)
3

Description

Hi all,

when I try to pass a custom profile I get this error:

> serverless publishSite

 
  Type Error ---------------------------------------------
 
  TypeError: Cannot read property 'toString' of null
      at ServerlessPlugin.runAwsCommand (C:\Users\MY_WORKSPACE_PATH\serverless-single-page-app-plugin\index.js:47:34)
      at ServerlessPlugin.syncDirectory (C:\Users\MY_WORKSPACE_PATH\serverless-single-page-app-plugin\index.js:66:28)
      at ServerlessPlugin.publishSite (C:\Users\MY_WORKSPACE_PATH\serverless-single-page-app-plugin\index.js:151:10)
      at C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:490:55
      at tryCatcher (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\util.js:16:23)
      at Object.gotValue (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\reduce.js:168:18)
      at Object.gotAccum (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\reduce.js:155:25)
      at Object.tryCatcher (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\util.js:16:23)
      at Promise._settlePromiseFromHandler (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:547:31)
      at Promise._settlePromise (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:604:18)
      at Promise._settlePromiseCtx (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:641:10)
      at _drainQueueStep (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:97:12)
      at _drainQueue (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:86:9)
      at Async._drainQueues (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:102:5)
      at Immediate.Async.drainQueues (C:\Users\MY_USER\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:15:14)
      at processImmediate (internal/timers.js:439:21)
      at process.topLevelDomainCallback (domain.js:126:23)
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              12.0.0
     Framework Version:         1.71.1
     Plugin Version:            3.6.12
     SDK Version:               2.3.0
     Components Version:        2.30.10

The error is on the const stdout = result.stdout.toString(); of the runAwsCommand function

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in index.js at the runAwsCommand call on line 47, then follow its use from syncDirectory and publishSite. Reproduce the command with a custom profile and inspect why result.stdout is null; done means the custom-profile publish no longer fails with the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
cloud, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.