deploy command not picking up deploy.env variables

Open
#301 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the deploy command in package.json, deploy.env, and the credential-related code around lib/main.js lines 700-701. Trace how --configFile values and other node-lambda CLI parameters reach the AWS request, then verify deployment with the reported configuration succeeds without the invalid-token error.

Written by the indexing model from the issue text.

Description

question

In my package.json I have the following deploy command in scripts:

  "scripts": {
    "deploy": "node-lambda deploy --configFile deploy.env --prebuiltDirectory dist",

My deploy.env is:

AWS_ACCESS_KEY_ID=xxx
AWS_SECRET_ACCESS_KEY=yyy

If I log the key and secret key here I get this:

your_key your_secret

followed by this error:

The security token included in the request is invalid.

UnrecognizedClientException: The security token included in the request is invalid.
    at Object.extractError (MY_PROJECT\node_modules\aws-sdk\lib\protocol\json.js:48:27)
    at Request.extractError (MY_PROJECT\node_modules\aws-sdk\lib\protocol\rest_json.js:37:8)
    at Request.callListeners (MY_PROJECT\node_modules\aws-sdk\lib\sequential_executor.js:105:20)
    at Request.emit (MY_PROJECT\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
    at Request.emit (MY_PROJECT\node_modules\aws-sdk\lib\request.js:678:14)
    at Request.transition (MY_PROJECT\node_modules\aws-sdk\lib\request.js:22:10)
    at AcceptorStateMachine.runTo (MY_PROJECT\node_modules\aws-sdk\lib\state_machine.js:14:12)
    at MY_PROJECT\node_modules\aws-sdk\lib\state_machine.js:26:10
    at Request.<anonymous> (MY_PROJECT\node_modules\aws-sdk\lib\request.js:38:9)
    at Request.<anonymous> (MY_PROJECT\node_modules\aws-sdk\lib\request.js:680:12)

I'm not sure what the problem is here. Can I not use a combination of --configFile and other node-lambda CLI parameters?

The env vars are in the params if I print those out:

params { FunctionName: 'MY_FUNCTION_NAME',
  Code: { ZipFile: <Buffer 50 4b 03 04 0a 00 00 00 08 00 49 58 bd 4a 9e b6 b4 2d 70 ff 07 00 81 ac 24 00 08 00 00 00 69 6e 64 65 78 2e 6a 73 ec bd 7b 7b 1b 37 ae 38 fc 7f 9e e7 ... > },
  Handler: 'index.handler',
  Role: 'your_amazon_role',
  Runtime: 'nodejs6.10',
  Description: '',
  MemorySize: '128',
  Timeout: '3',
  Publish: false,
  VpcConfig: { SubnetIds: [], SecurityGroupIds: [] },
  Environment:
   { Variables:
      { AWS_ACCESS_KEY_ID: 'xxx',
        AWS_SECRET_ACCESS_KEY: 'yyy' } },
  DeadLetterConfig: { TargetArn: null },
  TracingConfig: { Mode: null } }
Dominant language
JavaScript
Stars
1.4k
Forks
185
PR merge metrics
No merged PRs in 30d

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.

More from motdotla/node-lambda

All issues in motdotla/node-lambda

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.