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

sls deoloy and local stack results are not sync ? CLI has error but app.localstack.cloud is success.

Open riki-someya-ragate opened this issue 4 years ago • 1 comments

I contract for Pro version.

I'm trying to deploy localstack, but localstack cli outputs "ServerlessError:" it has not error detail.

I check cloudformation stack it is "UPDATE_INPROGRESS", So I waited until CloudFormationStack became UPDATE_COMPLETE and I redeployed, the deploy process was completed normally.

A first sls deploy has error, I think the CLI and local stack results are not sync.

I want to localstack deploy with success when first deploy and always.

Best regards 🙏

Environment

$ node -v
v12.16.3

$ sls --version
Framework Core: 2.28.7
Plugin: 4.4.3
SDK: 2.3.2
Components: 3.7.2

$ which localstack
/usr/local/bin/localstack

$ localstack --version
0.12.6.1

Serverkess.yml

service: Example

provider:
  name: aws
  runtime: nodejs12.x
  stage: '${opt:stage,"dev"}'
  region: ap-northeast-1
  profile: ragate
  role: DefaultLambdaRole
  apiGateway:
    shouldStartNameWithService: true
  lambdaHashingVersion: 20201221
  environment:
    SERVICE: '${self:service}'
    STAGE: '${self:provider.stage}'
    REGION: '${self:provider.region}'

plugins:
  - serverless-webpack
  - serverless-offline
  - serverless-localstack

custom:
  localstack:
    debug: true
    stages:
      - local
    autostart: true
    lambda:
      mountCode: false
    docker:
      sudo: false
  externalId: '${sls:instanceId}'
  webpack:
    includeModules: true
    packager: 'yarn'
  logLevel:
    local: 'debug'
    dev: 'debug'
    prd: 'info'

functions: ${file(./resources/functions.yml)}

resources:
  - ${file(./resources/cognito.yml)}
  - ${file(./resources/iam-role.yml)}
  - ${file(./resources/dynamodb-tables.yml)}
  - ${file(./resources/sqs.yml)}

package:
  individually: true
  exclude:
    - appsync/**
    - node_modules/**
    - resources/**
    - __tests__/**
    - package-lock.json
    - package.json
    - webpack.config.js
    - yarn.lock
    - README.md
    - .git/**
    - tmp/**

Logs

Failed ( First sls deploy )

  Serverless Error ---------------------------------------
 
  ServerlessError: 
      at /Users/username/.nvm/versions/node/v12.16.3/lib/node_modules/serverless/lib/plugins/aws/provider.js:1484:27
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.16.3
     Framework Version:         2.28.7
     Plugin Version:            4.4.3
     SDK Version:               2.3.2
     Components Version:        3.7.2

Success

Service Information
service: Example
stage: local
region: ap-northeast-1
stack: Example-local
resources: NN
api keys:
  None
endpoints:
  http://localhost:4566/restapis/xxxxxx/local/_user_request_
functions:
  getTodoById: Example-local-getTodoById
  postTodo: Example-local-postTodo
  putTodo: Example-local-putTodo
  deleteTodo: Example-local-deleteTodo
layers:
  None

Stack Outputs
ServerlessDeploymentBucketName: example-local-none-xxxxx
GetTodoByIdLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:000000000000:function:Example-local-getTodoById:$LATEST:$LATEST
PostTodoLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:000000000000:function:Example-local-postTodo:$LATEST:$LATEST
DeleteTodoLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:000000000000:function:Example-local-deleteTodo:$LATEST:$LATEST
PutTodoLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:000000000000:function:Example-local-putTodo:$LATEST:$LATEST
ServiceEndpoint: https://g4n86u7ygv.execute-api.ap-northeast-1.localhost/local

Serverless: Invoke aws:deploy:finalize
Serverless: [AWS s3 200 0.034s 0 retries] listObjectsV2({
  Bucket: 'example-local-none-xxxxx',
  Prefix: 'serverless/Example/local'
})
✨  Done in 110.00s.

riki-someya-ragate avatar Mar 08 '21 06:03 riki-someya-ragate

When I delete cloudFormation stack, CLI outputs error but the cloudformation status on app.localstack.cloud is in "DELETE_IN_PROGRESS".

That means CLI ( serverless ) and local stack results are not sync.

$  awslocal cloudformation delete-stack --stack-name=example

Unable to parse response (syntax error: line 1, column 54), invalid XML received. Further retries may succeed:
b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>\n'

ghost avatar Mar 08 '21 07:03 ghost

Hi @riki-someya-ragate,

apologies for the late reply. Could you check if you still this error when you pull the latest localstack image, and upgrade the serverless-localstack plugin? If you still do, could you please share the related logs?

steffyP avatar Oct 13 '23 17:10 steffyP

This issue seems to be stale. As we didn't get any response in two months, we are closing this issue now. Please feel free to reopen if it still persists, and provide updates logs and details.

steffyP avatar Dec 15 '23 10:12 steffyP