deploy command not picking up deploy.env variables

未关闭
#301 12 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
aws, javascript, node.js
领域
cli, cloud

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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 } }
主要语言
JavaScript
星标
1.4k
派生
185
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

motdotla/node-lambda 的其他 Issue

查看 motdotla/node-lambda 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。