0

service: testnewman
# app and org for use with dashboard.serverless.com
#app: your-app-name
#org: your-org-name

plugins:
  - serverless-bundle
  - serverless-pseudo-parameters
  - serverless-plugin-stack-config
  - serverless-plugin-newman
  - serverless-shell

# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
frameworkVersion: '2'

provider:
  name: aws
  runtime: nodejs12.x
  stage: ${opt:stage, 'simi33'}
  region: ${opt:region, 'us-west-2'}
  profile: ${opt:profile, 'sandbox'}


functions:
  hello:
    handler: handler.hello

custom:
  collection:
    file: test/postman_collection.json
  environment:
    file: test/deploy.postman_environment.json
    values:
      - key: endpoint
        enabled: true
        value: ServiceEndpoint
        type: OUTPUTS

这就是我的 serverless.yml 文件的样子。lambda 函数创建得很好。

当我运行命令时:

serverless outputs --stage simi33 --region us-west-2 --profile sandbox

它说:

Serverless: Running "serverless" installed locally (in service node_modules)
Serverless: Retrieving Outputs...
Serverless: getValues.error: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
Serverless: TypeError: Cannot read property 'outputs' of undefined

这不是权限问题。如果不使用 stack-config 插件,我可以部署应用程序。

如果我运行 sls deploy -v 命令,这就是我得到的:


Stack Outputs
HelloLambdaFunctionQualifiedArn: arn:aws:lambda:us-west-2:102483920364:function:testnewman-simi33-hello:1
ServerlessDeploymentBucketName: testnewman-simi33-serverlessdeploymentbucket-1u4ci9eebg2es

Serverless: Retrieving Outputs...
Serverless: Calling CloudFormation...
Serverless: getValues.error: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
Serverless: Writing Outputs...
Serverless: TypeError: Cannot read property 'outputs' of undefined

我的个人资料沙箱被配置为“承担”一个角色,并且在其他任何地方都可以正常工作。使用堆栈配置,如果我使用不必承担角色的配置文件,它可以正常工作。我怎样才能解决这个问题?如何将其与承担角色的配置文件一起使用?

我怎样才能解决这个问题?沙盒配置文件配置如下:

[vln-iam]
aws_access_key_id = ABCDEFGHIJKL
aws_secret_access_key = thkjgfthcghvjbjhfxhgchvmcf


[sandbox]
role_arn = arn:aws:iam::123456789:role/Admin
source_profile = vln-iam
region = us-west-2
mfa_serial = arn:aws:iam::987654321:mfa/sikau
4

0 回答 0