serverless-localstack icon indicating copy to clipboard operation
serverless-localstack copied to clipboard

AttributeError: 'LogGroup' object has no attribute 'get_cfn_attribute'

Open nguyenhoai890 opened this issue 5 years ago • 2 comments
trafficstars

Hi Team,

I'm trying to use serverless with localstack and ran into an issue when running: SLS_DEBUG=* sls deploy --stage=local

The localstack docker showed error as below,please check the error_log.txt for more information:

localstack_pktest_main |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 153, in clean_json
localstack_pktest_main |     result = clean_json_orig(resource_json, resources_map)
localstack_pktest_main |   File "/opt/code/localstack/.venv/lib/python3.7/site-packages/moto/cloudformation/parsing.py", line 166, in clean_json
localstack_pktest_main |     return resource.get_cfn_attribute(resource_json["Fn::GetAtt"][1])
localstack_pktest_main | AttributeError: 'LogGroup' object has no attribute 'get_cfn_attribute'

My Environment from sls debug is:

    Operating System:          darwin
     Node Version:              12.13.1
     Framework Version:         1.58.0
     Plugin Version:            3.2.5
     SDK Version:               2.2.1
     Components Core Version:   1.1.2
     Components CLI Version:    1.4.0

my docker-compose is:

version: '2.1'
services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack_pktest_main}"
    image: localstack/localstack:latest
    ports:
      - "4567-4597:4567-4597"
      - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
    environment:
      - SERVICES=${SERVICES- }
      - DEBUG=${DEBUG- }
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=${PORT_WEB_UI- }
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
      - LAMBDA_REMOTE_DOCKER=false
      - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

My serverless.yml is:

service: pktest
app: pktest
org: gotest

plugins:
  - serverless-localstack

frameworkVersion: '>=1.28.0 <2.0.0'

provider:
  name: aws
  runtime: go1.x

package:
  exclude:
    - ./**
  include:
    - ./bin/**

functions:
  hello:
    handler: bin/hello
    environment:
      BUCKET_NAME: ${self:custom.bucket}
  world:
    handler: bin/world
    environment:
      BUCKET_NAME: ${self:custom.bucket}

custom:
  localstack:
    bucket: pktest
    debug: true
    lambda:
      mountCode: true
    stages:
      - local
    host: http://localhost

I have attached error_log, sls_debug log.

Could you please help me on this case? Thanks, error_log_localstack.docx sls_deploy_logs.docx

┆Issue is synchronized with this Jira Task by Unito

nguyenhoai890 avatar Dec 16 '19 10:12 nguyenhoai890

Thanks for reporting @nguyenhoai890 . This should be fixed in https://github.com/localstack/localstack/pull/1894 . Can you please give it another try after doing a docker pull localstack/localstack? Please report here if the problem persists. Thanks

whummer avatar Dec 20 '19 18:12 whummer

@whummer I am experiencing this exact issue with the following minimal serverless.yml file in the pro edition of localstack when using this plugin.

# Identify the particular service that we're deploying.
org: testio
app: test-platform
service: metadata-api

# Specifically use versions of Serverless which address the rollback bug.
frameworkVersion: ">=1.62.0"

# Import our required plugins.
plugins:
  - serverless-deployment-bucket
  - serverless-localstack

# Specify our provider and any environment variables.
provider:
  name: aws
  runtime: nodejs12.x
  region: us-east-1
  deploymentBucket:
    name: test-${param:env}-deployments

# Webpack should explicitly exclude the AWS SDK; this is always present.
# Warmup should be disabled by default and enabled for specific functions.
custom:
  localstack:
    stages:
      - local
    lambda:
      mountCode: True

# Specify functions to deploy.
functions:
  hello:
    handler: hello.index
    events:
      - http:
          path: submit
          method: post

TimTinkers avatar Apr 29 '20 07:04 TimTinkers

closing the issue due to inactivity.

steffyP avatar Sep 18 '23 09:09 steffyP