99x / serverless-react-boilerplate

A serverless react boilerplate for offline development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when following installation instructions

bhirsch42 opened this issue · comments

I get the following error when running either npm install or yarn on a fresh clone of the repository.

$ cd serverless && npm install
npm ERR! git rev-list -n1 serverless_v1: fatal: ambiguous argument 'serverless_v1': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 serverless_v1: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 serverless_v1: 'git <command> [<revision>...] -- [<file>...]'
npm ERR! git rev-list -n1 serverless_v1: 
npm ERR! Darwin 14.0.0
npm ERR! argv "/usr/local/Cellar/node/0.10.32/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.4.0
npm ERR! npm  v3.10.3
npm ERR! code 128

npm ERR! Command failed: git rev-list -n1 serverless_v1
npm ERR! fatal: ambiguous argument 'serverless_v1': unknown revision or path not in the working tree.
npm ERR! Use '--' to separate paths from revisions, like this:
npm ERR! 'git <command> [<revision>...] -- [<file>...]'
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/benhirsch/Github/1000minutes/serverless/npm-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

And then these are the offending lines in the log:

769 silly mapToRegistry uri https://registry.yarnpkg.com/serverless-dynamodb-local
770 verbose addNameVersion registry:https://registry.yarnpkg.com/serverless-dynamodb-local not in flight; fetching
771 verbose get https://registry.yarnpkg.com/serverless-dynamodb-local not expired, no request
772 silly cache afterAdd serverless-dynamodb-local@0.2.17
773 verbose afterAdd /Users/benhirsch/.npm/serverless-dynamodb-local/0.2.17/package/package.json not in flight; writing
774 verbose correctMkdir /Users/benhirsch/.npm correctMkdir not in flight; initializing
775 verbose afterAdd /Users/benhirsch/.npm/serverless-dynamodb-local/0.2.17/package/package.json written
776 verbose updateRemote git fetch -a origin (https://github.com/dherault/serverless-offline.git/)
777 verbose correctMkdir /Users/benhirsch/.npm/_git-remotes correctMkdir not in flight; initializing
778 verbose setPermissions git+https://github.com/dherault/serverless-offline.git/#serverless_v1 set permissions on /Users/benhirsch/.npm/_git-remotes/git-https-github-com-dherault-serverless-offline-git-serverless-v1-6b02a695
779 verbose resolveHead git+https://github.com/dherault/serverless-offline.git/#serverless_v1 original treeish: serverless_v1
780 info git [ 'rev-list', '-n1', 'serverless_v1' ]
781 error git rev-list -n1 serverless_v1: fatal: ambiguous argument 'serverless_v1': unknown revision or path not in the working tree.
781 error git rev-list -n1 serverless_v1: Use '--' to separate paths from revisions, like this:
781 error git rev-list -n1 serverless_v1: 'git <command> [<revision>...] -- [<file>...]'
782 silly fetchPackageMetaData Error: Command failed: git rev-list -n1 serverless_v1
782 silly fetchPackageMetaData fatal: ambiguous argument 'serverless_v1': unknown revision or path not in the working tree.
782 silly fetchPackageMetaData Use '--' to separate paths from revisions, like this:
782 silly fetchPackageMetaData 'git <command> [<revision>...] -- [<file>...]'
782 silly fetchPackageMetaData
782 silly fetchPackageMetaData     at ChildProcess.exithandler (child_process.js:206:12)
782 silly fetchPackageMetaData     at emitTwo (events.js:106:13)
782 silly fetchPackageMetaData     at ChildProcess.emit (events.js:191:7)
782 silly fetchPackageMetaData     at maybeClose (internal/child_process.js:852:16)
782 silly fetchPackageMetaData     at Socket.<anonymous> (internal/child_process.js:323:11)
782 silly fetchPackageMetaData     at emitOne (events.js:96:13)
782 silly fetchPackageMetaData     at Socket.emit (events.js:188:7)
782 silly fetchPackageMetaData     at Pipe._handle.close [as _onclose] (net.js:492:12)
782 silly fetchPackageMetaData  error for serverless-offline@git+https://github.com/dherault/serverless-offline.git/#serverless_v1 { Error: Command failed: git rev-list -n1 serverless_v1
782 silly fetchPackageMetaData fatal: ambiguous argument 'serverless_v1': unknown revision or path not in the working tree.
782 silly fetchPackageMetaData Use '--' to separate paths from revisions, like this:
782 silly fetchPackageMetaData 'git <command> [<revision>...] -- [<file>...]'
782 silly fetchPackageMetaData
782 silly fetchPackageMetaData     at ChildProcess.exithandler (child_process.js:206:12)
782 silly fetchPackageMetaData     at emitTwo (events.js:106:13)
782 silly fetchPackageMetaData     at ChildProcess.emit (events.js:191:7)
782 silly fetchPackageMetaData     at maybeClose (internal/child_process.js:852:16)
782 silly fetchPackageMetaData     at Socket.<anonymous> (internal/child_process.js:323:11)
782 silly fetchPackageMetaData     at emitOne (events.js:96:13)
782 silly fetchPackageMetaData     at Socket.emit (events.js:188:7)
782 silly fetchPackageMetaData     at Pipe._handle.close [as _onclose] (net.js:492:12)
782 silly fetchPackageMetaData   killed: false,
782 silly fetchPackageMetaData   code: 128,
782 silly fetchPackageMetaData   signal: null,
782 silly fetchPackageMetaData   cmd: 'git rev-list -n1 serverless_v1' }
783 silly rollbackFailedOptional Starting
784 silly rollbackFailedOptional Finishing
785 silly runTopLevelLifecycles Starting
786 silly runTopLevelLifecycles Finishing
787 silly install printInstalled
788 verbose stack Error: Command failed: git rev-list -n1 serverless_v1
788 verbose stack fatal: ambiguous argument 'serverless_v1': unknown revision or path not in the working tree.
788 verbose stack Use '--' to separate paths from revisions, like this:
788 verbose stack 'git <command> [<revision>...] -- [<file>...]'
788 verbose stack
788 verbose stack     at ChildProcess.exithandler (child_process.js:206:12)
788 verbose stack     at emitTwo (events.js:106:13)
788 verbose stack     at ChildProcess.emit (events.js:191:7)
788 verbose stack     at maybeClose (internal/child_process.js:852:16)
788 verbose stack     at Socket.<anonymous> (internal/child_process.js:323:11)
788 verbose stack     at emitOne (events.js:96:13)
788 verbose stack     at Socket.emit (events.js:188:7)
788 verbose stack     at Pipe._handle.close [as _onclose] (net.js:492:12)
789 verbose cwd /Users/benhirsch/Github/1000minutes/serverless
790 error Darwin 14.0.0
791 error argv "/usr/local/Cellar/node/0.10.32/bin/node" "/usr/local/bin/npm" "install"
792 error node v6.4.0
793 error npm  v3.10.3
794 error code 128
795 error Command failed: git rev-list -n1 serverless_v1
795 error fatal: ambiguous argument 'serverless_v1': unknown revision or path not in the working tree.
795 error Use '--' to separate paths from revisions, like this:
795 error 'git <command> [<revision>...] -- [<file>...]'
796 error If you need help, you may report this error at:
796 error     <https://github.com/npm/npm/issues>
797 verbose exit [ 1, true ]

Can anybody tell me what exactly is going wrong?

Hi @bhirsch42 we are looking in to this now and trying to recreate the issue. Will update you once we fixed it.

@bhirsch42 Have you installed a previous version of serverless (serverelss_v1) globally in your machine? Could you please check the current serverless version with 'serverless -v' command and let me know.

The first time I performed a global serverless install was with yarn a couple weeks ago.

Here's the result of running sls -v:

11:22 $ sls -v
1.0.3

@bhirsch42 I still couldn't recreate this issue. My environment is,
git --version git version 1.9.5.msysgit.1
node --version v6.3.0
npm --version 3.10.6

@rehrumesh @AshanFernando Could you recreate the above issue?

However I found couple of S/O questions regarding similar issues.
According to that, you should have a branch named 'serverless_v1' and also a file or a directory named 'serverless_v1', and that caused this problem.

http://stackoverflow.com/questions/26349191/fatal-ambiguous-argument-branch-name-both-revision-and-filename

Ran into the same issue here. I was able to get past this by modifying serverless-react-boilerplate/serverless/package.json. I changed the line:

"serverless-offline": "git+https://github.com/dherault/serverless-offline.git/#serverless_v1",

to:

"serverless-offline": "git+https://github.com/dherault/serverless-offline.git",

Thank you all so much for the help. @mypalmike's change made everything install perfectly!

Now I'm just having a problem where, even though I've populated serverless/.env with my AWS credentials, I'm still getting a missing credentials error:

{ TimeoutError: Missing credentials in config
  at ClientRequest.<anonymous> (/Users/benhirsch/Github/serverless-react-boilerplate/serverless/node_modules/aws-sdk/lib/http/node.js:56:34)
  at ClientRequest.g (events.js:286:16)
  at emitNone (events.js:86:13)
  at ClientRequest.emit (events.js:185:7)
  at Socket.emitTimeout (_http_client.js:614:10)
  at Socket.g (events.js:286:16)
  at emitNone (events.js:86:13)
  at Socket.emit (events.js:185:7)
  at Socket._onTimeout (net.js:333:8)
  at tryOnTimeout (timers.js:232:11)
  at Timer.listOnTimeout (timers.js:202:5)

  message: 'Missing credentials in config',
  code: 'CredentialsError',
  time: 2016-10-25T02:12:47.822Z,
  retryable: true,
  originalError: 
   { message: 'Could not load credentials from any providers',
     code: 'CredentialsError',
     time: 2016-10-25T02:12:47.822Z,
     retryable: true,
     originalError: 
      { message: 'Connection timed out after 1000ms',
        code: 'TimeoutError',
        time: 2016-10-25T02:12:47.821Z,
        retryable: true } } }



  Credentials Error --------------------------------------



     Missing credentials in config


     For debugging logs, run again after setting SLS_DEBUG env var.

  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 Infomation -----------------------------
     OS:                 darwin

     Node Version:       6.4.0

     Serverless Version: 1.0.3

Any ideas why that might be happening?

Thanks again for being so quick to help me out.

Update!

I added my credentials this way...

export AWS_ACCESS_KEY_ID=<key>
export AWS_SECRET_ACCESS_KEY=<secret>

...and everything worked perfectly!

I'm completely up and running. Hooray!

But if the project is supposed to load AWS credentials from the .env file, something's fishy.

Thanks again!

Since the serverless support of accessing environment variables is still underdevelopment Issue:1455 we have used serverless-plugin-write-env-vars. This plugin allows to pass command-line parameters and set them as environment variables. The plugin uses dotenv library.
We could skip the plugin and just use dotenv library. If we follow this approach we can define all our environment variables in .env file. eg:

  DB_CONNECTION_STRING: <connection_string>
  REMOTE_STAGE: <remote_stage>
  ...

The only drawback is we won't be able to pass down command-line options to set as environment variables. But on the plus side, we have the luxury of defining all the environment variables in one place and just use 'gulp deploy' to do the deployment.
What do you all think of keeping a .env file and removing the plugin?

At the moment it is an overhead to include an environmental variable where you need to update serverless.yml and gulpfile(To support gulp deploy-api). Also when there are many environmental variables it makes it even problematic to append them as parameters. So I think its better to just use the dotenv library and .env file to support environmental variables for Lambda-NodeJS

@bhirsch42 Remember to add the following code as early as possible in your lambda code
require('dotenv').config();