GithubHelp home page GithubHelp logo

aws-cdk-local's Introduction

Integration Tests

AWS Cloud Development Kit (CDK) for LocalStack

This project provides a thin wrapper script cdklocal for using the AWS CDK library against local APIs provided by LocalStack.

Note: This project replaces the old (deprecated) repo which was a fork of the AWS CDK repo. Instead of forking the repo and applying changes, we now simply provide a simple wrapper script cdklocal which applies runtime patching. The advantage of the new approach is that you should be able to use arbitrary CDK versions under the cover.

Quick Installation

The cdklocal command line is published as an npm library:

$ npm install -g aws-cdk-local aws-cdk
...
$ cdklocal --version
1.65.5

Note: Starting with version 1.65.2, the dependency aws-cdk needs to be installed manually (to decouple the two libraries, and allow using arbitrary versions of aws-cdk under the covers).

(Note: Depending on your local setup, you may or may not have to use the global npm installation flag -g above.)

Configurations

The following environment variables can be configured:

  • AWS_ENDPOINT_URL: The endpoint URL to connect to (combination of USE_SSL/LOCALSTACK_HOSTNAME/EDGE_PORT below)
  • EDGE_PORT (deprecated): Port under which LocalStack edge service is accessible (default: 4566)
  • LOCALSTACK_HOSTNAME (deprecated): Target host under which LocalStack edge service is accessible (default: localhost)
  • USE_SSL (deprecated): Whether to use SSL to connect to the LocalStack endpoint, i.e., connect via HTTPS.
  • LAMBDA_MOUNT_CODE: Whether to use local Lambda code mounting (via setting __local__ S3 bucket name). Note: may require CDK version <2.14.0 to be fully functional.
  • BUCKET_MARKER_LOCAL: Magic S3 bucket name for Lambda mount and hot reloading (default: __local__, will default to hot-reload in a future release)

Deploying a Sample App

The CDK command line ships with a sample app generator to run a quick test for getting started:

$ mkdir /tmp/test; cd /tmp/test
$ cdklocal init sample-app --language=javascript
...

Make sure that LocalStack is installed and started up with the required services:

$ SERVICES=serverless,sqs,sns localstack start

Then deploy the sample app against the local APIs via the cdklocal command line:

$ cdklocal deploy
...
Do you wish to deploy these changes (y/n)? y
...
Stack ARN:
arn:aws:cloudformation:us-east-1:000000000000:stack/TestStack/e3debc0a-311e-4968-8230-ed78f89cb614

Once the deployment is done, you can inspect the created resources via the awslocal command line:

$ awslocal sns list-topics
{
    "Topics": [
        {
            "TopicArn": "arn:aws:sns:us-east-1:000000000000:TestStack-TestTopic339EC197-79F43WWCCS4Z"
        }
    ]
}

Change Log

  • 2.18.0: Add support for AWS_ENDPOINT_URL, USE_SSL, and BUCKET_MARKER_LOCAL configurations
  • 2.17.0: Fix IPv4 fallback check to prevent IPv6 connection issue with localhost on macOS
  • 2.16.0: Add check to prevent IPv6 connection issue with localhost on MacOS
  • 2.15.0: Fix issue with undefined BUCKET_NAME_OUTPUT variable; add CI build and eslint config
  • 2.14.0: Add switches in patches to accommodate new esbuild packaging mechanism in CDK v2.14.0+
  • 1.65.7: Add switch that checks for asset existence before symlinking assets; fix parsing fetched template body for JSON/YAML formats; add missing dependency to "diff" package
  • 1.65.6: Create symlinks to Lambda assets to enable persistent code mounting of Lambdas on "cdklocal synth"
  • 1.65.5: Add support for LAMBDA_MOUNT_CODE config to enable local Lambda code mounting
  • 1.65.4: Add support for large stacks by patching bucketUrl for ToolkitInfo
  • 1.65.2: Patch missing getPromise() in forceCredentialRetrieval; remove aws-cdk from npm dependencies
  • 1.65.1: Override BucketURL to use path style addressing
  • 1.65.0: Initial release

License

The AWS CDK is distributed under the Apache License, Version 2.0.

aws-cdk-local's People

Contributors

aminfazlmondo avatar dominikschubert avatar joe4dev avatar martinjlowm avatar merowinger92 avatar rehmanvirani-10p avatar thrau avatar ubaidbaig-10p avatar whummer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-cdk-local's Issues

ERROR: Non-whitespace before first tag

Hi,

When running cdklocal deploy I get the above error, which suggests there's something trying to parse XML

further info:

Line: 0
Column: 1
Char: {
Found errors

It also looks like the error is coming from code generated by cdklocal deploy

LOC-38 ⁃ deployment of serverless 1.65.0 returns error ECONNREFUSED 127.0.0.1:4567

since updating to the latest version (1.65.0) of serverless I am getting an error message after deploying to Localstack.

Serverless: config.options_stage: development
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: ${opt:stage, 'development'}
Serverless: config.stage: development
Serverless: Using serverless-localstack
Serverless: Reconfiguring service apigateway to use http://localhost:4567
Serverless: Reconfiguring service cloudformation to use http://localhost:4581
Serverless: Reconfiguring service cloudwatch to use http://localhost:4582
Serverless: Reconfiguring service lambda to use http://localhost:4574
Serverless: Reconfiguring service dynamodb to use http://localhost:4569
Serverless: Reconfiguring service kinesis to use http://localhost:4568
Serverless: Reconfiguring service route53 to use http://localhost:4580
Serverless: Reconfiguring service firehose to use http://localhost:4573
Serverless: Reconfiguring service stepfunctions to use http://localhost:4585
Serverless: Reconfiguring service es to use http://localhost:4578
Serverless: Reconfiguring service s3 to use http://localhost:4572
Serverless: Reconfiguring service ses to use http://localhost:4579
Serverless: Reconfiguring service sns to use http://localhost:4575
Serverless: Reconfiguring service sqs to use http://localhost:4576
Serverless: Reconfiguring service sts to use http://localhost:4592
Serverless: Reconfiguring service iam to use http://localhost:4593
Serverless: Reconfiguring service ssm to use http://localhost:4583
Serverless: Reconfiguring service rds to use http://localhost:4594
Serverless: Reconfiguring service ec2 to use http://localhost:4597
Serverless: Reconfiguring service elasticache to use http://localhost:4598
Serverless: Reconfiguring service kms to use http://localhost:4599
Serverless: Reconfiguring service secretsmanager to use http://localhost:4584
Serverless: Reconfiguring service logs to use http://localhost:4586
Serverless: Reconfiguring service cloudwatchlogs to use http://localhost:4586
Serverless: Reconfiguring service iot to use http://localhost:4589
Serverless: Reconfiguring service cognito-idp to use http://localhost:4590
Serverless: Reconfiguring service cognito-identity to use http://localhost:4591
Serverless: Reconfiguring service ecs to use http://localhost:4601
Serverless: Reconfiguring service eks to use http://localhost:4602
Serverless: Reconfiguring service xray to use http://localhost:4603
Serverless: Reconfiguring service appsync to use http://localhost:4605
Serverless: Reconfiguring service cloudfront to use http://localhost:4606
Serverless: Reconfiguring service athena to use http://localhost:4607
Serverless: Warning: Unable to find plugin named: TypeScriptPlugin
Serverless: config.options_stage: development
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: development
Serverless: config.stage: development
Serverless: config.options_stage: development
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: development
Serverless: config.stage: development
Serverless: Using deployment bucket 'shift-planner-asyncjobs'
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Serverless: Typescript compiled.
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Service files not changed. Skipping deployment...
Service Information
service: shift-planner-asyncjobs
stage: development
region: eu-west-1
stack: shift-planner-asyncjobs-development
resources: 5
api keys:
  None
endpoints:
  None
functions:
  shiftPublishedEmails: shift-planner-asyncjobs-development-shiftPublishedEmails
layers:
  None

Stack Outputs
ServerlessDeploymentBucketName: shift-planner-asyncjobs
ShiftPublishedEmailsLambdaFunctionQualifiedArn: ShiftPublishedEmailsLambdaVersionFBinxqNcQ4hoU4l1I0378dVUKpD30oJdG3FSg4Xf0

Serverless: Recoverable error occurred (connect ECONNREFUSED 127.0.0.1:4567), sleeping for ~6 seconds. Try 1 of 4
Serverless: Recoverable error occurred (connect ECONNREFUSED 127.0.0.1:4567), sleeping for ~7 seconds. Try 2 of 4
Serverless: Recoverable error occurred (connect ECONNREFUSED 127.0.0.1:4567), sleeping for ~4 seconds. Try 3 of 4
Serverless: Recoverable error occurred (connect ECONNREFUSED 127.0.0.1:4567), sleeping for ~7 seconds. Try 4 of 4

  Serverless Error ---------------------------------------

  connect ECONNREFUSED 127.0.0.1:4567

  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.1
     Framework Version:         1.65.0
     Plugin Version:            3.4.1
     SDK Version:               2.3.0
     Components Version:        2.22.3

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy-localstack: `node --max-old-space-size=4096 node_modules/serverless/bin/serverless --stage development deploy --verbose`
npm ERR! Exit status 1here is the serverless file:```

service:
name: shift-planner-asyncjobs

plugins:

  • serverless-deployment-bucket
  • serverless-localstack
  • serverless-plugin-typescript
  • serverless-offline

provider:
name: aws
runtime: nodejs12.x
region: 'eu-west-1'
stage: ${opt:stage, 'development'}
memorySize: 512
deploymentBucket:
name: shift-planner-asyncjobs
serverSideEncryption: AES256
tracing:
apiGateway: true
lambda: true
environment:
ENV: ${self:provider.stage, 'development'}
REGION: 'eu-west-1'

custom:
localstack:
stages:
- development
debug: true
host: 'http://localhost'

functions:
publishedEmails:
handler: handler.someHandler
events:
- sqs:
arn:
Fn::Join:
- ':'
- - arn
- aws
- sqs
- Ref: AWS::Region
- Ref: AWS::AccountId
- queueName


I compared the logs of the two versions and seems like in the version 1.65.0 i am missing this part here :

Serverless: Using custom endpoint for S3: http://localhost:4572
Serverless: Using custom endpoint for CloudFormation: http://localhost:4581
Serverless: Using custom endpoint for S3: http://localhost:4572
Serverless: Using custom endpoint for S3: http://localhost:4572
Serverless: Using custom endpoint for Lambda: http://localhost:4574
Serverless: Using custom endpoint for STS: http://localhost:4592
Serverless: Uploading CloudFormation file to S3...
Serverless: Using custom endpoint for S3: http://localhost:4572
Serverless: Uploading artifacts...
Serverless: Uploading service shift-planner-asyncjobs.zip file to S3 (7.57 MB)...
Serverless: Using custom endpoint for S3: http://localhost:4572
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Creating Stack...
Serverless: Using custom endpoint for CloudFormation: http://localhost:4581
Serverless: Overriding S3 templateUrl to http://localhost:4572
Serverless: Checking Stack create progress...
Serverless: Using custom endpoint for CloudFormation: http://localhost:4581
CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - shift-planner-asyncjobs-development
Serverless: Stack create finished...
Serverless: Using custom endpoint for CloudFormation: http://localhost:4581
Serverless: Using custom endpoint for CloudFormation: http://localhost:4581


after checking the code in the repo, I noticed that most of these logs come from the function 'interceptRequest(service, method, params)'

the lambda function works as expected, but this error message keeps on popping off after each deploy.
prior I was using serverless 1.53.0 and everything was smooth



┆Issue is synchronized with this [Jira Task](https://localstack.atlassian.net/browse/LOC-38) by [Unito](https://www.unito.io/learn-more)

I can't create the cloudformation changeset

Hi,

I'm trying to deploy a VPC through cdklocal, but I'm not be able to achieve it. If do you need more informatio about it, let me know.
Command:

AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test ../node_modules/aws-cdk-local/bin/cdklocal deploy localstack-vpc-stack

Error:

localstack-vpc-stack: deploying...
localstack-vpc-stack: creating CloudFormation changeset...

 ❌  localstack-vpc-stack failed: 500: 
    at Request.extractError (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/query.js:55:29)
    at Request.callListeners (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:690:12)
    at Request.callListeners (/Users/ismael/git/code/platform-infra-lib/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  code: 500,
  time: 2021-03-17T17:46:12.186Z,
  requestId: undefined,
  statusCode: 500,
  retryable: true
}

Localstack Image:

localstack/localstack                                                                     latest                                                            28b721e18989   8 days ago      668MB

Localstack logs:

localstack_main | 2021-03-17T17:46:12:INFO:localstack.utils.cloudformation.template_deployer: Unable to apply change set cdk-deploy-change-set: Unable to extract attribute "Ref" from "EC2::NatGateway" model class <class 'moto.ec2.models.NatGateway'>
localstack_main | 2021-03-17T17:46:12:ERROR:cloudformation_api: Exception on / [POST]
localstack_main | Traceback (most recent call last):
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
localstack_main |     response = self.full_dispatch_request()
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
localstack_main |     rv = self.handle_user_exception(e)
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack_main |     return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
localstack_main |     reraise(exc_type, exc_value, tb)
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
localstack_main |     raise value
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
localstack_main |     rv = self.dispatch_request()
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
localstack_main |     return self.view_functions[rule.endpoint](**req.view_args)
localstack_main |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 549, in handle_request
localstack_main |     result = func(req_params)
localstack_main |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 438, in execute_change_set
localstack_main |     deployer.apply_change_set(change_set)
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1750, in apply_change_set
localstack_main |     change_set.changes = self.apply_changes(change_set.stack, change_set, stack_name=change_set.stack_name)
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1970, in apply_changes
localstack_main |     return self.apply_changes_in_loop(changes, existing_stack, stack_name)
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1996, in apply_changes_in_loop
localstack_main |     should_deploy = self.prepare_should_deploy_change(
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 2036, in prepare_should_deploy_change
localstack_main |     resolve_refs_recursively(stack.stack_name, resource, new_resources)
localstack_main |   File "/opt/code/localstack/localstack/utils/common.py", line 390, in func
localstack_main |     return wrapped(*args, **kwargs)
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1066, in resolve_refs_recursively
localstack_main |     value[key] = resolve_refs_recursively(stack_name, val, resources)
localstack_main |   File "/opt/code/localstack/localstack/utils/common.py", line 390, in func
localstack_main |     return wrapped(*args, **kwargs)
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1066, in resolve_refs_recursively
localstack_main |     value[key] = resolve_refs_recursively(stack_name, val, resources)
localstack_main |   File "/opt/code/localstack/localstack/utils/common.py", line 390, in func
localstack_main |     return wrapped(*args, **kwargs)
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 968, in resolve_refs_recursively
localstack_main |     ref = resolve_ref(stack_name, value['Ref'], resources, attribute='Ref')
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 934, in resolve_ref
localstack_main |     return determine_resource_physical_id(resource_id=ref,
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1582, in determine_resource_physical_id
localstack_main |     result = extract_resource_attribute(resource_type, {}, attribute or 'PhysicalResourceId',
localstack_main |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/localstack_ext/services/cloudformation/cloudformation_extended.py", line 654, in extract_resource_attribute
localstack_main |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 797, in extract_resource_attribute
localstack_main |     raise Exception('Unable to extract attribute "%s" from "%s" model class %s' % (
localstack_main | Exception: Unable to extract attribute "Ref" from "EC2::NatGateway" model class <class 'moto.ec2.models.NatGateway'>

docker-compose:


version: '2.1'

services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
    image: localstack/localstack
    network_mode: bridge
    ports:
      - "4566:4566"
      - "4571:4571"
    environment:
      - SERVICES=ec2,route53,cloudformation
      - DEBUG=${DEBUG- }
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=${PORT_WEB_UI- }
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
      - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR}
      - DEFAULT_REGION=eu-central-1
      - LOCALSTACK_API_KEY=xxxxxxxxx

    volumes:
      - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

cdklocal deploy failed to update existing stack

I have a fairly simple CDK stack which has a lambda and a REST API method.

import * as cdk from '@aws-cdk/core';

import * as lambda from "@aws-cdk/aws-lambda";
import * as apigateway from "@aws-cdk/aws-apigateway";

export class HelloWorldLocalStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const dynamoLambda = new lambda.Function(this, "DynamoLambdaHandler", {
			runtime: lambda.Runtime.NODEJS_12_X,
			code: lambda.Code.fromAsset("./functions"),
			handler: "function.handler",
    });

    // create API Gateway so lambda method can be accessed via REST API
    const api = new apigateway.RestApi(this, "hello-api");
    api.root.resourceForPath("hello")
      .addMethod("GET", new apigateway.LambdaIntegration(dynamoLambda));

    new cdk.CfnOutput(this, "HTTP API URL", {
      value : api.url ?? "Something went wrong with the deploy"
    });
  }
}

The first time I deploy it with
> cdklocal deploy
It succeeds and I can then invoke it with following URL
http://localhost:4566/restapis/<rest-api-id>/<stage>/_user_request_/<method-path>

I made some small adjustment to the lambda function and wanted to update by entering
> cdklocal deploy
It fails though

❌  HelloWorldLocalStack failed: Missing Parameter: Missing parameter AssetParameters236c4e0757113194f56b4906a2c18526c39f451f1b8846c7fad71f336e84d9a4S3BucketDE617CE9
    at Request.extractError (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\protocol\query.js:50:29)
    at Request.callListeners (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
    at Request.emit (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
    at Request.emit (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\request.js:688:14)
    at Request.transition (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\request.js:22:10)
    at AcceptorStateMachine.runTo (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\state_machine.js:14:12)
    at C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\state_machine.js:26:10
    at Request.<anonymous> (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\request.js:38:9)
    at Request.<anonymous> (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\request.js:690:12)
    at Request.callListeners (C:\Users\yolo\.npm-packages\node_modules\aws-cdk-local\node_modules\aws-sdk\lib\sequential_executor.js:116:18) {
  code: 'Missing Parameter',
  time: 2020-11-30T14:20:24.335Z,
  requestId: undefined,
  statusCode: 400,
  retryable: false,
  retryDelay: 290.2886774860529
}
Missing parameter AssetParameters236c4e0757113194f56b4906a2c18526c39f451f1b8846c7fad71f336e84d9a4S3BucketDE617CE9

I deployed the same stack to AWS, and then made the same update in which it succeed with deploying the update too.

So I'm wondering what is the "Missing Parameter" it is asking? Or how do I deploy updates with cdklocal?

LOC-46 ⁃ Usage with Webpack

When using localstack.lambda.mountCode, the handler file is used when the running the lambda inside the localstack container:

docker run -i  -v "/xx/folder":/var/task -e ...  --rm "lambci/lambda:nodejs8.10" "./src/functions/index.handler"

As the ./src/functions/index.handler is the un-transpiled version, as it hasnt gone through webpack yet, it errors.

How would you recommend using localstack.lambda.mountCode with serverless-webpack?

┆Issue is synchronized with this Jira Task by Unito

The Sample App doesn't work

I'm following the deploying-a-sample-app process, and there's no error but:

  • No queue or topics are created

See below the console logs:

➜  localstack npx cdklocal deploy     
This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:

IAM Statement Changes
┌───┬───────────────┬────────┬────────────────────────┬────────────────────────┬──────────────────────────┐
│   │ Resource      │ Effect │ Action                 │ Principal              │ Condition                │
├───┼───────────────┼────────┼────────────────────────┼────────────────────────┼──────────────────────────┤
│ + │ ${XQueue.Arn} │ Allow  │ sqs:SendMessage        │ Service:sns.amazonaws. │ "ArnEquals": {           │
│   │               │        │                        │ com                    │   "aws:SourceArn": "${XT │
│   │               │        │                        │                        │ opic}"                   │
│   │               │        │                        │                        │ }                        │
└───┴───────────────┴────────┴────────────────────────┴────────────────────────┴──────────────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Do you wish to deploy these changes (y/n)? y
XStack: deploying...
XStack: creating CloudFormation changeset...



 ✅  XStack

Stack ARN:
arn:aws:cloudformation:eu-west-1:000000000000:stack/XStack/b73c901f

And the topic listing logs:

➜  localstack awslocal sns list-topics
{
    "Topics": []
}

The versions I used are:

"aws-cdk-local": "1.65.8"
"aws-cdk": "1.119.0"

LOC-30 ⁃ apiKeys/usagePlan not supported

I have a function that required an apiKey.
The gateway's endpoint exists but it fails

"The security token included in the request is invalid."

Looking at Moto I noticed I have a path to retrieve apiKeys and usagePlan. It returns an empty array on both counts.
It seems none are created when I run sls deploy --stage local.
In AWS (sls deploy --stage dev) it works fine.

I exported the cloudformaiton stack output when running local.

So here are the defects/questions:

**1. Are apiKets and usagePlan supported?

  1. Why is a function created in AWS when I run it locally**

Here is the stack-local.json

{
  "ServerlessDeploymentBucketName": "hello-local-serverlessdeploymentbucket-1zocaat71p",
  "EnterpriseLogAccessIamRole": "arn:aws:iam::000000000000:role/cf-hello-local-7d29cfc90000ecf5ca94c1ef30a842",
  "ChanceLambdaFunctionQualifiedArn": "ChanceLambdaVersionQw0GRKWEP40hVpdfVpuID54OcxS6K90mUSWN78",
  "RegistrarLambdaFunctionQualifiedArn": "RegistrarLambdaVersiongB1BIRyX6CwDq2fJUTCkt6VKa5e7BLwuLM1SLE",
  **"ServiceEndpoint": "https://aahxs5c0n.execute-api.us-east-1.amazonaws.com/local"**
}

Here is the serverless.yml

tenant: pepe
app: hello
service: hello

plugins:
  - serverless-pseudo-parameters
  - serverless-stack-output
  - serverless-localstack

provider:
  name: aws
  runtime: nodejs12.x
  iamRoleStatements:
    - Effect: Allow
      Action: dynamodb:scan
      Resource: arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/transactions
    - Effect: Allow
      Action: lambda:InvokeFunction
      Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:hello-dev-registrar
  apiKeys:
    - free:
        - myFreeKey
        - ${opt:stage}-myFreeKey
    - paid:
        - myPaidKey
        - ${opt:stage}-myPaidKey
  usagePlan:
    - free:
        quota:
          limit: 5000
          offset: 2
          period: MONTH
        throttle:
          burstLimit: 200
          rateLimit: 100
    - paid:
        quota:
          limit: 50000
          offset: 1
          period: MONTH
        throttle:
          burstLimit: 2000
          rateLimit: 1000

functions:
  chance:
    handler: functions/chance/index.handler
    events:
      - http:
          path: /chance/
          method: post
          private: true
          cors: true
  registrar:
    handler: functions/registrar.handler
    environment:
      transactions_table: transactions

resources:
  Resources:
    transactionsTables:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: transactions
        AttributeDefinitions:
          - AttributeName: game_id
            AttributeType: S
        KeySchema:
          - AttributeName: game_id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1

custom:
  output:
    file: .build/stack-${opt:stage}.json
  localstack:
    debug: true
    stages:
      - local

┆Issue is synchronized with this Jira Task by Unito

LOC-33 ⁃ variables in profile name breaks sls logs

I'm getting some strange behavior when i have serverless variables in my profile name, like this:

custom:
  defaultStage: local
  stage: ${opt:stage, self:custom.defaultStage}
  localstack:
    stages:
      - local
    lambda:
      mountCode: True

provider:
  profile: ${self:custom.stage}Profile
  ....

Depending on the command and the parameters, I'll sometimes get Error: Profile ${self:custom.stage}Profile does not exist

  • sls deploy works perfectly.
  • sls deploy -s local throws the error
  • sls print works perfectly.
  • sls print -s local throws the error

sls logs works differently. if i call it without the stage variable, it tries to call the real aws endpoint

  • sls logs -f myFunc throws The security token included in the request is invalid..
  • sls print -s local throws the profile error

┆Issue is synchronized with this Jira Task by Unito

LOC-44 ⁃ 500 error from serverless on deployment

Copied from: localstack/localstack#855 Koalk


Can't seem to create tickets on the new project, feel free to copy this into it once issues are enabled on it.
I am trying to deploy a local version of 2 lambdas plus a stepfunction, all quite basic stuff.
I get a 500 error from the serverless side of the deployment and quite the amount of logs in the localstack side. I'll put both here in case they are of any use.
Localstack logs
Serverless logs
serverless.yml

Is suppose to be a basic "lambda one loads new data somewhere and lambda two does some processing on it" with the step function as a glue between them and failover.

┆Issue is synchronized with this Jira Task by Unito

LOC-23 ⁃ Version inconsistency between cdk and cdklocal

While testing cdklocal, we found some inconsistencies. Despite having cdk installed (and pegged to version 1.67.0), it seems that cdk and cdk-local's cdk versions are out of sync

root@ea857e43d7ef:/usr/local/src# cdk --version
1.67.0 (build 2b4dd71)
root@ea857e43d7ef:/usr/local/src# cdklocal --version
1.69.0 (build 2b474b9)

I thought i might have been related to how we install cdk, npm install -g [email protected], so i changed it to npm install -g [email protected]. That made no difference.

For context, we have a docker-compose.yml that includes:

  localstack:
    image: localstack/localstack
    ports:
      - "4566:4566"
    environment:
      - SERVICES=cloudformation,ec2,iam,lambda,rds,s3,secretsmanager,sqs
      - DEBUG=${DEBUG-True}
      - DATA_DIR=/tmp/localstack/data
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-docker-reuse}
      - DOCKER_HOST=unix:///var/run/docker.sock
      - DEFAULT_REGION=us-west-2
    volumes:
      - "./build/localstack:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

We have another defined docker service that installs all our cdk requirements (npm and python) and where the code lives and is then executed.

There are other issues that are blocking us currently (#1), but having version inconsistencies is odd.

┆Issue is synchronized with this Jira Bug by Unito

LOC-34 ⁃ Unable to use external YAML files to configure plugin

WIth the following configuration:

plugins: 
  - serverless-localstack
custom: 
  localstack: ${file(../../localstack.yml):localstack}

The plugin does not get configured properly and ends up just using plugin's default configuration.

If I do a serverless print the output is as expected with the proper configuration:

plugins:
  - serverless-localstack
custom:
  localstack:
    stages:
      - local
    autostart: true
    endpoints: null
    lambda:
      mountCode: false
    docker:
      sudo: false
    debug: true

My use case is that I am maintaining a monorepo of Lambda functions and would desire to not replicate configuration across each function. Another note, as I know that this has lifecycle considerations as well, is that I am using SSM parameters in my provider block.

Is this desired, if not is it feasible to support this?

┆Issue is synchronized with this Jira Task by Unito

LOC-31 ⁃ mountCode: True with serverless-python-requirements

If mountCode: True deploy crashing other hand mountCode: False deploy is ok.
serverless-python-requirements
serverless-localstack

serverless.yml

Slightly modified https://github.com/serverless/examples/tree/master/aws-python-line-echo-bot

# ⚠️⚠️ REPLACE THIS COMMENT WITH FULL serverless.yml CONTENT
service: aws-python-line-echo-bot
provider:
  name: aws
  runtime: python3.7

functions:
  line_bot:
    handler: handler.webhook
    events:
      - http:
          path: /webhook
          method: POST
plugins:
  - serverless-localstack
  - serverless-python-requirements
custom:
  localstack:
    debug: true
    stages:
      - local
    host: http://localhost  # optional - LocalStack host to connect to
    autostart: true  # optional - start LocalStack in Docker on Serverless deploy
    endpoints:
      # This section is optional - can be used for customizing the target endpoints
      S3: http://localhost:4572
      Lambda: http://localhost:4574
    lambda:
      # Enable this flag to improve performance
      mountCode: True
    docker:
      # Enable this flag to run "docker ..." commands as sudo
      sudo: False
  stages:
    local:
serverless deploy --stage local output
aws-python-line-echo-bot>sls deploy --stage local
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: config.options_stage: local
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: dev
Serverless: config.stage: local
Serverless: Using serverless-localstack
Serverless: Reconfiguring service apigateway to use http://localhost:4567
Serverless: Reconfiguring service cloudformation to use http://localhost:4581
Serverless: Reconfiguring service cloudwatch to use http://localhost:4582
Serverless: Reconfiguring service lambda to use http://localhost:4574
Serverless: Reconfiguring service dynamodb to use http://localhost:4569
Serverless: Reconfiguring service kinesis to use http://localhost:4568
Serverless: Reconfiguring service route53 to use http://localhost:4580
Serverless: Reconfiguring service firehose to use http://localhost:4573
Serverless: Reconfiguring service stepfunctions to use http://localhost:4585
Serverless: Reconfiguring service es to use http://localhost:4578
Serverless: Reconfiguring service s3 to use http://localhost:4572
Serverless: Reconfiguring service ses to use http://localhost:4579
Serverless: Reconfiguring service sns to use http://localhost:4575
Serverless: Reconfiguring service sqs to use http://localhost:4576
Serverless: Reconfiguring service sts to use http://localhost:4592
Serverless: Reconfiguring service iam to use http://localhost:4593
Serverless: Reconfiguring service ssm to use http://localhost:4583
Serverless: Reconfiguring service rds to use http://localhost:4594
Serverless: Reconfiguring service ec2 to use http://localhost:4597
Serverless: Reconfiguring service elasticache to use http://localhost:4598
Serverless: Reconfiguring service kms to use http://localhost:4599
Serverless: Reconfiguring service secretsmanager to use http://localhost:4584
Serverless: Reconfiguring service logs to use http://localhost:4586
Serverless: Reconfiguring service cloudwatchlogs to use http://localhost:4586
Serverless: Reconfiguring service iot to use http://localhost:4589
Serverless: Reconfiguring service cognito-idp to use http://localhost:4590
Serverless: Reconfiguring service cognito-identity to use http://localhost:4591
Serverless: Reconfiguring service ecs to use http://localhost:4601
Serverless: Reconfiguring service eks to use http://localhost:4602
Serverless: Reconfiguring service xray to use http://localhost:4603
Serverless: Reconfiguring service appsync to use http://localhost:4605
Serverless: Reconfiguring service cloudfront to use http://localhost:4606
Serverless: Reconfiguring service athena to use http://localhost:4607
Serverless: Reconfiguring service S3 to use http://localhost:4572
Serverless: Reconfiguring service Lambda to use http://localhost:4574
Serverless: Warning: Unable to find plugin named: TypeScriptPlugin
Serverless: Load command deploy
Serverless: Load command requirements
Serverless: Load command requirements:clean
Serverless: Load command requirements:install
Serverless: Load command requirements:cleanCache
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Load command dev
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: config.options_stage: local
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: dev
Serverless: config.stage: local
Serverless: config.options_stage: local
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: dev
Serverless: config.stage: local
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Generated requirements from G:\projects\parse\trash\examples\aws-python-line-echo-bot\requirements.txt in G:\projects\parse\trash\examples\aws-python-line-echo-bot\.ser
verless\requirements.txt...
Serverless: Installing requirements from G:\projects\parse\trash\examples\aws-python-line-echo-bot\.serverless\requirements\requirements.txt ...
Serverless: Running ...
Serverless: Skip plugin function Package.packageService (lambda.mountCode flag is enabled)
Serverless: Injecting required Python packages to package...

  Type Error [ E R R_ I N V A L I D_ A R G_ T Y P E] -----

  TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined
      at readFile (fs.js:296:3)
      at go$readFile (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\graceful-fs\graceful-fs.js:118:14)
      at Object.readFile (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\graceful-fs\graceful-fs.js:115:12)
      at Object.readFile (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\universalify\index.js:5:67)
      at injectRequirements (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless-python-requirements\lib\inject.js:23:6)
      at ServerlessPythonRequirements.injectAllRequirements (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless-python-requirements\lib\inject.js:120
:12)
      at ServerlessPythonRequirements.BbPromise.bind.then.then.then (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless-python-requirements\index.js:
183:43)
  From previous event:
      at Object.after [as hook] (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless-python-requirements\index.js:182:10)
  From previous event:
      at PluginManager.invoke (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\classes\PluginManager.js:489:22)
      at PluginManager.spawn (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\classes\PluginManager.js:509:17)
      at BbPromise.try (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\plugins\deploy\deploy.js:122:50)
  From previous event:
      at Object.before:deploy:deploy [as hook] (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\plugins\deploy\deploy.js:102:22)
      at BbPromise.reduce (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\classes\PluginManager.js:489:55)
  From previous event:
      at PluginManager.invoke (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\classes\PluginManager.js:489:22)
      at getHooks.reduce.then (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\classes\PluginManager.js:524:24)
  From previous event:
      at PluginManager.run (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\classes\PluginManager.js:524:8)
      at variables.populateService.then (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\Serverless.js:131:33)
  From previous event:
      at Serverless.run (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\lib\Serverless.js:118:74)
      at serverless.init.then (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\bin\serverless.js:80:26)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:126:23)
  From previous event:
      at Object.<anonymous> (G:\projects\parse\trash\examples\aws-python-line-echo-bot\node_modules\serverless\bin\serverless.js:80:4)
      at Module._compile (internal/modules/cjs/loader.js:778:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
      at Module.load (internal/modules/cjs/loader.js:653:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
      at Function.Module._load (internal/modules/cjs/loader.js:585:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              10.16.3
     Framework Version:         1.73.1
     Plugin Version:            3.6.13
     SDK Version:               2.3.1
     Components Version:        2.31.0

┆Issue is synchronized with this Jira Task by Unito

LOC-28 ⁃ Unable to deploy onto localstack (but ok on AWS)

Hi,

Trying to deploy onto localstack but getting this exception from serverless, it is kind of weird since the same stack works properly when running sls deploy on AWS.

Localstack: 0.11.4
serverless: 1.81.1
serverless-localstack: 0.4.27

Below is the serverless.yml:

service:
  name: 'jizo-accts'

frameworkVersion:  '>=1.72.0'

plugins:
  - serverless-webpack  
  - serverless-dynamodb-local
  - serverless-offline-sqs
  - serverless-offline  
  - serverless-localstack

custom:
  webpack:
    webpackConfig: './webpack.config.js'
    includeModules: true
  serverless-offline-sqs:
    autoCreate: false
    apiVersion: '2012-11-05'
    endpoint: http://0.0.0.0:4576
    region: us-east-1
    accessKeyId: root
    secretAccessKey: root
    skipCacheInvalidation: false    
  serverless-offline:
    stage:
      -local
    lambdaPort: 4574
  dynamodb:
    stages:
      - local      
    start:
      port: 4569
      inMemory: true
      heapInitial: 128m
      heapMax: 1g
      migrate: true
  localstack:
    docker:
      sudo: false
    debug: true
    endpoints:
      S3: http://localhost:4572
      DynamoDB: http://localhost:4569
      CloudFormation: http://localhost:4581
      Elasticsearch: http://localhost:4571
      ES: http://localhost:4578
      SNS: http://localhost:4575
      SQS: http://localhost:4576
      Lambda: http://localhost:4574
      Kinesis: http://localhost:4568
    host: "http://localhost"
    lambda:
      mountCode: false
    stages:
      - dev

provider:
  name: 'aws'
  apiGateway: 
    minimumCompressionSize: 1024
  environment:
    AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1'
    ML_EXT_LOOPBACK: 'NO'
    ML_EXT_DEBUG: 'YES'
    ML_EXT_SYSENV: ${opt:stage}
    ML_CLOUD_REGION: ${opt:region}       
  runtime: 'nodejs12.x'
  iamRoleStatements:
    - Effect: 'Allow'
      Action:
        - 'sqs:ReceiveMessage'
        - 'sqs:DeleteMessage'
      Resource:
        - "arn:aws:sqs:::${self:service}-${opt:stage}-RescopeQueue"
        - "arn:aws:sqs:::${self:service}-${opt:stage}-UncopeQueue"
    - Effect: 'Allow'
      Action:
        - 'sqs:SendMessage'
      Resource: '*'
    - Effect: 'Allow'
      Action:
        - 'dynamodb:DeleteItem'
        - 'dynamodb:PutItem'
        - 'dynamodb:Query'
        - 'dynamodb:Scan'
      Resource:
        - "arn:aws:dynamodb:::jizo.${opt:stage}.accountsTable"
        - "arn:aws:dynamodb:::jizo.${opt:stage}.identitiesTable"
        - "arn:aws:dynamodb:::jizo.${opt:stage}.acctsAuditTrialTable"
        - "arn:aws:dynamodb:::jizo.${opt:stage}.usersTable"
    - Effect: 'Allow'
      Action: 
        - 's3:GetObject'
      Resource:
        - "arn:aws:s3:::${self:service}.${opt:stage}.identity"
    - Effect: 'Allow'
      Action:
        - 'sns:Public'
      Resource:
        - "arn:aws:sns:::${self:service}-${opt:stage}-registerAccount"
        - "arn:aws:sns:::${self:service}-${opt:stage}-unregisterAccount"
    - Effect: 'Allow'
      Action:
        - 'sns:Subscribe'
      Resource: '*'       
        
functions:
  rescope:
    handler: src/sqs.rescope
    description: "To handle rescoping account via the invoicing service"
    events:
      - sqs:
          arn: 
            Fn::GetAtt:
              - RescopeQueue
              - Arn            
  unscope:
    handler: src/sqs.unscope
    description: "To handle unscoping account via the invoicing service"
    events:
      - sqs:
          arn: 
            Fn::GetAtt:
              - UnscopeQueue
              - Arn            
  userGet:
    handler: src/lambda.userGet    
    description: 'provide sync call to get user data'
  identify: 
    handler: src/s3.identify
    description: "Trigger identity creation and validation when receiving files upload to bucket"
    events:
      - s3:
        bucket: "${self:service}.${opt:stage}.identity"
        event: s3:ObjectCreate:*          
  router:
    handler: src/http.router
    description: 'primary REST related handlers for this service'
    events:
      - http: 'GET {proxy+}'
      - http: 'POST {proxy+}'
      - http: 'PATCH {proxy+}'
      - http: 'PUT {proxy+}'
      - http: 'DELETE {proxy+}'
      - http: 'OPTIONS {proxy+}'
      - http: 'HEAD {proxy+}'
  
resources:
  Resources:
    # s3 configuration
    identityBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: "${self:service}.${opt:stage}.identity"

    # dynamodb configuration
    accountsTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: "jizo.${opt:stage}.accountsTable"
        AttributeDefinitions:
          - AttributeName: object_id
            AttributeType: S
        KeySchema:
          - AttributeName: object_id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
    identitiesTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: "jizo.${opt:stage}.identitiesTable"
        AttributeDefinitions:
          - AttributeName: object_id
            AttributeType: S
        KeySchema:
          - AttributeName: object_id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
    acctTrailTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: "jizo.${opt:stage}.acctsAuditTrialTable"
        AttributeDefinitions:
          - AttributeName: object_id
            AttributeType: S
        KeySchema:
          - AttributeName: object_id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1        
    usersTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: "jizo.${opt:stage}.usersTable"
        AttributeDefinitions:
          - AttributeName: object_id
            AttributeType: S
        KeySchema:
          - AttributeName: object_id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1

    # incoming SQS configuration      
    RescopeQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: "${self:service}-${opt:stage}-RescopeQueue"
        VisibilityTimeout: 1080
        MessageRetentionPeriod: 2160
        RedrivePolicy:
          deadLetterTargetArn: 
            Fn::GetAtt:
              - RescopeBackupQueue
              - Arn
          maxReceiveCount: 3
    RescopeBackupQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: "${self:service}-${opt:stage}-RescopeBackupQueue"
    UnscopeQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: "${self:service}-${opt:stage}-UnscopeQueue"
        VisibilityTimeout: 1080
        MessageRetentionPeriod: 2160
        RedrivePolicy:
          deadLetterTargetArn: 
            Fn::GetAtt:
              - UnscopeBackupQueue
              - Arn
          maxReceiveCount: 3
    UnscopeBackupQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: "${self:service}-${opt:stage}-UnscopeBackupQueue"

    # SNS Definitions
    registerAccountTopic:
      Type: AWS::SNS::Topic
      Properties:
        TopicName: "${self:service}-${opt:stage}-registerAccount"

    unregisterAccountTopic:
      Type: AWS::SNS::Topic
      Properties:
        TopicName: "${self:service}-${opt:stage}-unregisterAccount"

The setup for localstack is as follow:

version: '2.1'
services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
    image: localstack/localstack:latest
    ports:
      - "4000-4597:4000-4597"
    environment:
      - SERVICES=${SERVICES- }
      # - SERVICES=sts,iam,cloudformation,s3,lambda,sqs,sns,ses,dynamodb,apigateway
      - DEBUG=1
      - DEFAULT_REGION=ap-southeast-1
      - DATA_DIR=${DATA_DIR- }
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- docker-reuse}
      - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR}
      - AWS_EXECUTION_ENV=true
    volumes:
      - "/tmp/localstack:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

The output from serverless was like this...

Serverless: config.options_stage: dev
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: dev
Serverless: config.stage: dev
Serverless: Using serverless-localstack
Serverless: Reconfiguring service apigateway to use http://localhost:4566
Serverless: Reconfiguring service cloudformation to use http://localhost:4566
Serverless: Reconfiguring service cloudwatch to use http://localhost:4566
Serverless: Reconfiguring service lambda to use http://localhost:4566
Serverless: Reconfiguring service dynamodb to use http://localhost:4566
Serverless: Reconfiguring service kinesis to use http://localhost:4566
Serverless: Reconfiguring service route53 to use http://localhost:4566
Serverless: Reconfiguring service firehose to use http://localhost:4566
Serverless: Reconfiguring service stepfunctions to use http://localhost:4566
Serverless: Reconfiguring service es to use http://localhost:4566
Serverless: Reconfiguring service s3 to use http://localhost:4566
Serverless: Reconfiguring service ses to use http://localhost:4566
Serverless: Reconfiguring service sns to use http://localhost:4566
Serverless: Reconfiguring service sqs to use http://localhost:4566
Serverless: Reconfiguring service sts to use http://localhost:4566
Serverless: Reconfiguring service iam to use http://localhost:4566
Serverless: Reconfiguring service ssm to use http://localhost:4566
Serverless: Reconfiguring service rds to use http://localhost:4566
Serverless: Reconfiguring service ec2 to use http://localhost:4566
Serverless: Reconfiguring service elasticache to use http://localhost:4566
Serverless: Reconfiguring service kms to use http://localhost:4566
Serverless: Reconfiguring service secretsmanager to use http://localhost:4566
Serverless: Reconfiguring service logs to use http://localhost:4566
Serverless: Reconfiguring service cloudwatchlogs to use http://localhost:4566
Serverless: Reconfiguring service iot to use http://localhost:4566
Serverless: Reconfiguring service cognito-idp to use http://localhost:4566
Serverless: Reconfiguring service cognito-identity to use http://localhost:4566
Serverless: Reconfiguring service ecs to use http://localhost:4566
Serverless: Reconfiguring service eks to use http://localhost:4566
Serverless: Reconfiguring service xray to use http://localhost:4566
Serverless: Reconfiguring service appsync to use http://localhost:4566
Serverless: Reconfiguring service cloudfront to use http://localhost:4566
Serverless: Reconfiguring service athena to use http://localhost:4566
Serverless: Reconfiguring service S3 to use http://localhost:4572
Serverless: Reconfiguring service DynamoDB to use http://localhost:4569
Serverless: Reconfiguring service CloudFormation to use http://localhost:4581
Serverless: Reconfiguring service Elasticsearch to use http://localhost:4571
Serverless: Reconfiguring service ES to use http://localhost:4578
Serverless: Reconfiguring service SNS to use http://localhost:4575
Serverless: Reconfiguring service SQS to use http://localhost:4576
Serverless: Reconfiguring service Lambda to use http://localhost:4574
Serverless: Reconfiguring service Kinesis to use http://localhost:4568
Serverless: Warning: Unable to find plugin named: TypeScriptPlugin
Serverless: Configuration warning:
Serverless:   at 'functions.identify.events[0]': unrecognized property 'bucket'
Serverless:   at 'functions.identify.events[0]': unrecognized property 'event'
Serverless:  
Serverless: If you prefer to not continue ensure "configValidationMode: error" in your config
Serverless: If errors are influenced by an external plugin, enquiry at plugin repository so schema extensions are added (https://www.serverless.com/framework/docs/providers/aws/guide/plugins#extending-validation-schema)
Serverless: If errors seem invalid, please report at https://github.com/serverless/serverless/issues/new?template=bug_report.md
Serverless: If you find this functionality problematic, you may turn it off with "configValidationMode: off" setting
Serverless:  
Serverless: config.options_stage: dev
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: dev
Serverless: config.stage: dev
Serverless: config.options_stage: dev
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: dev
Serverless: config.stage: dev
Serverless: Bundling with Webpack...
Time: 1056ms
Built at: 09/04/2020 01:11:16
            Asset      Size  Chunks                   Chunk Names
      src/http.js  19.6 KiB       0  [emitted]        src/http
  src/http.js.map  80.2 KiB       0  [emitted] [dev]  src/http
    src/lambda.js  13.8 KiB       1  [emitted]        src/lambda
src/lambda.js.map  47.4 KiB       1  [emitted] [dev]  src/lambda
        src/s3.js  8.87 KiB       2  [emitted]        src/s3
    src/s3.js.map  41.9 KiB       2  [emitted] [dev]  src/s3
       src/sqs.js  13.8 KiB       3  [emitted]        src/sqs
   src/sqs.js.map    48 KiB       3  [emitted] [dev]  src/sqs
Entrypoint src/sqs = src/sqs.js src/sqs.js.map
Entrypoint src/lambda = src/lambda.js src/lambda.js.map
Entrypoint src/s3 = src/s3.js src/s3.js.map
Entrypoint src/http = src/http.js src/http.js.map
 [0] external "@leungas/aws-orm" 42 bytes {0} {1} {2} {3} [built]
 [1] external "@leungas/lambda" 42 bytes {0} {1} {3} [built]
 [2] ./src/index.ts + 11 modules 13.5 KiB {0} {1} {2} {3} [built]
     | ./src/index.ts 55 bytes [built]
     | ./src/models/index.ts 151 bytes [built]
     | ./src/factories/index.ts 71 bytes [built]
     | ./src/models/user.ts 3 KiB [built]
     | ./src/models/account.ts 4.03 KiB [built]
     | ./src/models/account.owner.ts 474 bytes [built]
     | ./src/models/identity.ts 935 bytes [built]
     | ./src/models/identity.individual.ts 2.2 KiB [built]
     | ./src/factories/account.factory.ts 485 bytes [built]
     | ./src/factories/identity.factory.ts 1.78 KiB [built]
     | ./src/exceptions/serial.invalid-location.ts 168 bytes [built]
     | ./src/exceptions/serial.invalid-format.ts 181 bytes [built]
 [3] ./src/configuration/infrastructure/queues/dev.json 313 bytes {0} {1} {3} [built]
 [7] ./src/configuration/index.ts 125 bytes {0} {1} {3} [built]
 [8] ./src/configuration/dev.ts 579 bytes {0} {1} {3} [built]
 [9] ./src/configuration/prod.ts 581 bytes {0} {1} {3} [built]
[12] ./src/configuration/local.ts 578 bytes {0} {1} {3} [built]
[13] ./src/middlewares/exception.handler.ts 1.15 KiB {0} {1} [built]
[14] external "aws-sdk" 42 bytes {2} [built]
[15] external "lambda-api" 42 bytes {0} [built]
[16] ./src/http.ts + 17 modules 15.6 KiB {0} [built]
     | ./src/http.ts 3.03 KiB [built]
     | ./src/middlewares/application.loader.ts 288 bytes [built]
     | ./src/controllers/http/account.create.ts 2.16 KiB [built]
     | ./src/middlewares/account.admin.ts 652 bytes [built]
     | ./src/controllers/http/account.delete.ts 859 bytes [built]
     | ./src/controllers/http/account.disable.ts 768 bytes [built]
     | ./src/controllers/http/account.enable.ts 895 bytes [built]
     | ./src/controllers/http/account.settings.get.ts 540 bytes [built]
     | ./src/controllers/http/account.settings.set.ts 623 bytes [built]
     | ./src/controllers/http/user.create.ts 638 bytes [built]
     | ./src/controllers/http/user.delete.ts 656 bytes [built]
     | ./src/controllers/http/user.disable.ts 1.29 KiB [built]
     | ./src/controllers/http/user.enable.ts 1.25 KiB [built]
     | ./src/controllers/http/user.preference.get.ts 468 bytes [built]
     | ./src/controllers/http/user.preference.set.ts 594 bytes [built]
     |     + 3 hidden modules
[17] ./src/sqs.ts + 2 modules 2.55 KiB {3} [built]
     | ./src/sqs.ts 250 bytes [built]
     | ./src/controllers/sqs/account.rescope.ts 1.15 KiB [built]
     | ./src/controllers/sqs/account.unscope.ts 1.15 KiB [built]
[18] ./src/s3.ts + 2 modules 2.4 KiB {2} [built]
     | ./src/s3.ts 128 bytes [built]
     | ./src/controllers/s3/account.identify.ts 2.1 KiB [built]
     | ./src/exceptions/document.bad-cogn.ts 161 bytes [built]
[19] ./src/lambda.ts + 1 modules 1.32 KiB {1} [built]
     | ./src/lambda.ts 107 bytes [built]
     | ./src/controllers/lambda/user.get.ts 1.2 KiB [built]
    + 5 hidden modules
Serverless: WARNING: Could not determine version of module lambda-api
Serverless: WARNING: Could not determine version of module aws-sdk
Serverless: Package lock found - Using locked versions
Serverless: Packing external modules: @leungas/aws-orm@git+https://djonno-admin:[email protected]/djonno-backend/jizoo-core.git, @leungas/lambda@git+https://djonno-admin:[email protected]/djonno-backend/lambda-support.git, lambda-api, aws-sdk
Serverless: WARNING: Could not determine version of module lambda-api
Serverless: WARNING: Could not determine version of module aws-sdk
Serverless: Packaging service...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
.
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service jizo-accts.zip file to S3 (27.96 MB)...
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.
Serverless: Stack update finished...
 
  Type Error ---------------------------------------------
 
  TypeError: message.startsWith is not a function
      at /Users/leungas/.nvm/versions/node/v12.18.2/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:506:23
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  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.18.2
     Framework Version:         1.81.1
     Plugin Version:            3.8.2
     SDK Version:               2.3.1
     Components Version:        2.34.9

The error returned at localstack was started with this:

{code}
localstack_main | 2020-09-03T17:13:48:ERROR:localstack.services.cloudformation.cloudformation_starter: Unable to parse and create resource "UserGetLambdaVersionPqf01E84DnieuGEURTZ1hUcOiB4rTEKYaCX8RpZiBYs": 'FunctionName' Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 268, in parse_and_create_resource
localstack_main | return _parse_and_create_resource(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 340, in _parse_and_create_resource
localstack_main | raise moto_create_error
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 322, in _parse_and_create_resource
localstack_main | resource = parse_and_create_resource_orig(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 297, in parse_and_create_resource
localstack_main | resource = resource_class.create_from_cloudformation_json(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/awslambda/models.py", line 709, in create_from_cloudformation_json
localstack_main | function_name = properties["FunctionName"]
localstack_main | KeyError: 'FunctionName'
localstack_main |
localstack_main | 2020-09-03T17:13:48:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "DescribeStackResource" (500) POST /: b'\n<title>500 Internal Server Error</title>\n

Internal Server Error

\n

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.

\n'
localstack_main | 2020-09-03T17:13:48:WARNING:localstack.utils.cloudformation.template_deployer: Unable to get details for resource "ApiGatewayRestApi" in CloudFormation stack "jizo-accts-dev": Unable to parse response (syntax error: line 1, column 54), invalid XML received. Further retries may succeed:
localstack_main | b'\n<title>500 Internal Server Error</title>\n

Internal Server Error

\n

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.

\n'
localstack_main | 2020-09-03T17:13:48:ERROR:localstack.services.cloudformation.cloudformation_starter: Unable to parse and create resource "ApiGatewayResourceProxyVar": None Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 268, in parse_and_create_resource
localstack_main | return _parse_and_create_resource(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 404, in _parse_and_create_resource
localstack_main | update_resource_id(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 469, in update_resource_id
localstack_main | backend.apis[api_id].resources.pop(resource.id, None)
localstack_main | KeyError: None
localstack_main |
localstack_main | 2020-09-03T17:13:48:ERROR:localstack.services.cloudformation.cloudformation_starter: Unable to parse and create resource "ApiGatewayMethodProxyVarGet": None Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 268, in parse_and_create_resource
localstack_main | return _parse_and_create_resource(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 297, in _parse_and_create_resource
localstack_main | resource_tuple = parsing.parse_resource(logical_id, resource_json, resources_map)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 267, in parse_resource
localstack_main | resource_json = clean_json(resource_json, resources_map)
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 245, in clean_json
localstack_main | result = clean_json_orig(resource_json, resources_map)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 200, in clean_json
localstack_main | cleaned_val = clean_json(value, resources_map)
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 245, in clean_json
localstack_main | result = clean_json_orig(resource_json, resources_map)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 200, in clean_json
localstack_main | cleaned_val = clean_json(value, resources_map)
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 245, in clean_json
localstack_main | result = clean_json_orig(resource_json, resources_map)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 93, in clean_json
localstack_main | resource = resources_map[resource_json["Ref"]]
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 424, in getitem
localstack_main | new_resource = parse_and_create_resource(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 268, in parse_and_create_resource
localstack_main | return _parse_and_create_resource(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 404, in _parse_and_create_resource
localstack_main | update_resource_id(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 469, in update_resource_id
localstack_main | backend.apis[api_id].resources.pop(resource.id, None)
localstack_main | KeyError: None
localstack_main |
localstack_main | 2020-09-03 17:13:48,955:API: Error on request:
localstack_main | Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 323, in run_wsgi
localstack_main | execute(self.server.app)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 312, in execute
localstack_main | application_iter = app(environ, start_response)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/server.py", line 167, in call
localstack_main | return backend_app(environ, start_response)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2464, in call
localstack_main | return self.wsgi_app(environ, start_response)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
localstack_main | response = self.handle_exception(e)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack_main | return cors_after_request(app.make_response(f(_args, *_kwargs)))
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
localstack_main | reraise(exc_type, exc_value, tb)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
localstack_main | raise value
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
localstack_main | response = self.full_dispatch_request()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
localstack_main | rv = self.handle_user_exception(e)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack_main | return cors_after_request(app.make_response(f(_args, *_kwargs)))
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
localstack_main | reraise(exc_type, exc_value, tb)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
localstack_main | raise value
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
localstack_main | rv = self.dispatch_request()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
localstack_main | return self.view_functionsrule.endpoint
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/utils.py", line 146, in call
localstack_main | result = self.callback(request, request.url, {})
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 202, in dispatch
localstack_main | return cls()._dispatch(_args, *_kwargs)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 312, in dispatch
localstack_main | return self.call_action()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 397, in call_action
localstack_main | response = method()
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 886, in describe_stack_resource
localstack_main | for stack_resource in stack.stack_resources:
localstack_main | File "/usr/lib/python3.8/collections_abc.py", line 762, in iter

localstack_main | yield self._mapping[key]
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 424, in getitem
localstack_main | new_resource = parse_and_create_resource(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 268, in parse_and_create_resource
localstack_main | return _parse_and_create_resource(
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 340, in _parse_and_create_resource
localstack_main | raise moto_create_error
localstack_main | File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 322, in _parse_and_create_resource
localstack_main | resource = parse_and_create_resource_orig(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/parsing.py", line 297, in parse_and_create_resource
localstack_main | resource = resource_class.create_from_cloudformation_json(
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/awslambda/models.py", line 709, in create_from_cloudformation_json
localstack_main | function_name = properties["FunctionName"]
localstack_main | KeyError: 'FunctionName'
localstack_main | 2020-09-03T17:13:48:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "UpdateStack" (500) POST /: b'\n<title>500 Internal Server Error</title>\n

Internal Server Error

\n

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.

\n'
localstack_main | 2020-09-03 17:13:48,979:API: Error on request:
localstack_main | Traceback (most recent call last):
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 323, in run_wsgi
localstack_main | execute(self.server.app)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 312, in execute
localstack_main | application_iter = app(environ, start_response)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/server.py", line 167, in call
localstack_main | return backend_app(environ, start_response)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2464, in call
localstack_main | return self.wsgi_app(environ, start_response)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
localstack_main | response = self.handle_exception(e)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack_main | return cors_after_request(app.make_response(f(_args, *_kwargs)))
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
localstack_main | reraise(exc_type, exc_value, tb)
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
localstack_main | raise value
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
localstack_main | response = self.full_dispatch_request()
localstack_main | File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_d

┆Issue is synchronized with this Jira Task by Unito

Error: Need to perform AWS calls for account 000, but no credentials have been configured

Error running cdklocal bootstrap & deploy

Environment aws://000/us-west-2 failed bootstrapping: Error: Need to perform AWS calls for account 000, but no credentials have been configured

I am running localstack start in one powershell and cdklocal bootstrap/deploy in another. I also tried once with localstack started in a docker container and mapped to my computer's "localhost:4566"

Everything works fine when I actually deploy to AWS/CDK but does not work when I try localstack/CDK.

Troubleshooting

I feel like I've tried just about everything to get this to work, but no luck yet (including solutions from the other issues like #36 (comment) & #38). Here's what I've tried:

  • Deleting node_modules and cdk.out, then combinations of installing aws-cdk-local 1.65.3 & aws-cdk 1.86.0/1.89.0, globally/locally

  • Executing locally installed packages via "npx" command (e.g. npx cdklocal bootstrap)

  • Using cdklocal --profile flag with my actual account name and also with "default"

Setup

I can start my localstack just fine on Windows 10 and also in docker:
http://localhost:4566/health

"services": {
"cloudwatch": "running",
"iam": "running",
"lambda": "running",
"logs": "running",
"apigateway": "running"
}

C:/Users/me/.aws/config

[default]
sso_start_url = https://________.com/start
sso_region = us-west-2
sso_account_id = 9999999
sso_role_name = 9999999_MyRoleName
region = us-west-2
ca_bundle = C:\Program Files\Amazon\AWSCLIV2\mycert.pem
output = json[default]

C:/Users/me/.aws/credentials

[default]
aws_access_key_id=test
aws_secret_access_key=test
region=us-west-2

[(my account id)]
aws_access_key_id=(my key id)
aws_secret_access_key=(my access key)
aws_session_token=(my token)
region=us-west-2

package.json

"devDependencies": {
  ...
  "aws-cdk": "1.86.0",
  "aws-cdk-local": "^1.65.3",
  "typescript": "~3.9.7"
},
"dependencies": {
  "@aws-cdk/aws-ec2": "1.86.0",
  "@aws-cdk/aws-apigateway": "1.86.0",
  "@aws-cdk/aws-lambda": "1.86.0",
  "@aws-cdk/aws-logs": "1.86.0",
  "@aws-cdk/core": "1.86.0",
  ...
}

LOC-45 ⁃ Intermittent Error on Deployment "The specified bucket is not valid."

I am getting an intermittent error when attempting to deploy to localstack using serverless.

First, I start localstack directly...

$ LAMBDA_EXECUTOR=docker SERVICES=lambda,cloudformation,s3,sts localstack start
Starting local dev environment. CTRL-C to quit.
Starting mock CloudWatch Logs (http port 4586)...
Starting mock CloudFormation (http port 4581)...
Starting mock S3 (http port 4572)...
Starting mock STS (http port 4592)...
Starting mock Lambda service (http port 4574)...
 * Serving Flask app "lambda_api" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
Ready.

Then, very often, I get the following error when attempting to deploy...

kevinwarner ~/Documents/Projects/logicbox/localstack-test $ SLS_DEBUG=* AWS_PROFILE=wcf sls deploy -s local
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command deploy
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Using serverless-localstack
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Skip plugin function Package.packageService (lambda.mountCode flag is enabled)
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Skip plugin function AwsDeploy.extendedValidate (lambda.mountCode flag is enabled)
Serverless: Invoke aws:deploy:deploy
Serverless: [AWS cloudformation 400 0.03s 0 retries] describeStacks({ StackName: 'localstack-test-local' })
Serverless: Creating Stack...
Serverless: [AWS cloudformation 400 0.119s 0 retries] createStack({ StackName: 'localstack-test-local',
  OnFailure: 'DELETE',
  Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
  Parameters: [ [length]: 0 ],
  TemplateBody: '{"AWSTemplateFormatVersion":"2010-09-09","Description":"The AWS CloudFormation template for this Serverless application","Resources":{"ServerlessDeploymentBucket":{"Type":"AWS::S3::Bucket","Properties":{"BucketEncryption":{"ServerSideEncryptionConfiguration":[{"ServerSideEncryptionByDefault":{"SSEAlgorithm":"AES256"}}]}}}},"Outputs":{"ServerlessDeploymentBucketName":{"Value":{"Ref":"ServerlessDeploymentBucket"}}}}',
  Tags: [ { Key: 'STAGE', Value: 'local' }, [length]: 1 ] })

  Serverless Error ---------------------------------------

  The specified bucket is not valid.

  Stack Trace --------------------------------------------

ServerlessError: The specified bucket is not valid.
    at promise.catch.err (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:302:11)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     OS:                     darwin
     Node Version:           8.10.0
     Serverless Version:     1.44.1

Then, if I simply run the above depoy command again, often, but not always, the deploy works...

$ SLS_DEBUG=* AWS_PROFILE=wcf sls deploy -s local
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command deploy
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Using serverless-localstack
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Skip plugin function Package.packageService (lambda.mountCode flag is enabled)
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Skip plugin function AwsDeploy.extendedValidate (lambda.mountCode flag is enabled)
Serverless: Invoke aws:deploy:deploy
Serverless: [AWS cloudformation 400 0.027s 0 retries] describeStacks({ StackName: 'localstack-test-local' })
Serverless: Creating Stack...
Serverless: [AWS cloudformation 200 0.054s 0 retries] createStack({ StackName: 'localstack-test-local',
  OnFailure: 'DELETE',
  Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
  Parameters: [ [length]: 0 ],
  TemplateBody: '{"AWSTemplateFormatVersion":"2010-09-09","Description":"The AWS CloudFormation template for this Serverless application","Resources":{"ServerlessDeploymentBucket":{"Type":"AWS::S3::Bucket","Properties":{"BucketEncryption":{"ServerSideEncryptionConfiguration":[{"ServerSideEncryptionByDefault":{"SSEAlgorithm":"AES256"}}]}}}},"Outputs":{"ServerlessDeploymentBucketName":{"Value":{"Ref":"ServerlessDeploymentBucket"}}}}',
  Tags: [ { Key: 'STAGE', Value: 'local' }, [length]: 1 ] })
Serverless: Checking Stack create progress...
Serverless: [AWS cloudformation 200 0.017s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:123456789:stack/localstack-test-local/5b67cb9f-5c6c-4730-a444-00baa75485ac' })
..
Serverless: Stack create finished...
Serverless: [AWS cloudformation 200 0.012s 0 retries] describeStackResource({ StackName: 'localstack-test-local',
  LogicalResourceId: 'ServerlessDeploymentBucket' })
Serverless: [AWS s3 200 0.021s 0 retries] listObjectsV2({ Bucket: 'localstack-test-local-ServerlessDeploymentBucket-038864325861',
  Prefix: 'serverless/localstack-test/local' })
Serverless: [AWS sts 200 0.018s 0 retries] getCallerIdentity({})
Serverless: Uploading CloudFormation file to S3...
Serverless: [AWS s3 200 0.012s 0 retries] putObject({ Body: <Buffer 7b 22 41 57 53 54 65 6d 70 6c 61 74 65 46 6f 72 6d 61 74 56 65 72 73 69 6f 6e 22 3a 22 32 30 31 30 2d 30 39 2d 30 39 22 2c 22 44 65 73 63 72 69 70 74 ... >,
  Bucket: 'localstack-test-local-ServerlessDeploymentBucket-038864325861',
  Key: 'serverless/localstack-test/local/1559653335515-2019-06-04T13:02:15.515Z/compiled-cloudformation-template.json',
  ContentType: 'application/json',
  Metadata: { filesha256: 'YBpmXB/1aNso159t/k2HtYkUpYlTeKsLmNpnwJlAAX0=' } })
Serverless: Skip plugin function AwsDeploy.uploadFunctionsAndLayers (lambda.mountCode flag is enabled)
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Updating Stack...
Serverless: [AWS cloudformation 200 0.222s 0 retries] updateStack({ StackName: 'localstack-test-local',
  Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
  Parameters: [ [length]: 0 ],
  TemplateURL: 'https://s3.amazonaws.com/localstack-test-local-ServerlessDeploymentBucket-038864325861/serverless/localstack-test/local/1559653335515-2019-06-04T13:02:15.515Z/compiled-cloudformation-template.json',
  Tags: [ { Key: 'STAGE', Value: 'local' }, [length]: 1 ] })
Serverless: Checking Stack update progress...
Serverless: [AWS cloudformation 200 0.016s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:123456789:stack/localstack-test-local/5b67cb9f-5c6c-4730-a444-00baa75485ac' })
..
Serverless: Stack update finished...
Serverless: Invoke aws:info
Serverless: [AWS cloudformation 200 0.021s 0 retries] describeStacks({ StackName: 'localstack-test-local' })
Serverless: [AWS cloudformation 200 0.017s 0 retries] listStackResources({ StackName: 'localstack-test-local' })
Service Information
service: localstack-test
stage: local
region: us-east-1
stack: localstack-test-local
resources: 5
api keys:
  None
endpoints:
  None
functions:
  hello: localstack-test-local-hello
layers:
  None
Serverless: Invoke aws:deploy:finalize
Serverless: [AWS s3 200 0.01s 0 retries] listObjectsV2({ Bucket: 'localstack-test-local-ServerlessDeploymentBucket-038864325861',
  Prefix: 'serverless/localstack-test/local' })
Serverless Enterprise: Run `serverless login` and deploy again to explore, monitor, secure your serverless project for free.Sometimes, the first attempt works, but sometimes it does not. Sometimes, it takes several deploy attempts to get it to work.I really want to get this set up in my CI process, so this uncertainty is going to cause issues. Is there anything you see that is / could be causing the intermittent issue?

Note: I also get the same intermittent problem when starting localstack with all services.

Thanks!

┆Issue is synchronized with this Jira Task by Unito

Cannot create VPC for RDS service:

Issue

Whenever requiring CDK to create a VPC, run into an issue:

botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the CreateCloudFormationTemplate operation: The security token included in the request is invalid.

It looks to only occur specifically with VPCs in my issues.

I have managed to work around this so far by using the aws-cli directly to create a local RDS instance or just simply ignoring the VPC/RDS stack during local dev and running a Postgres container. Of course, that does mean that I am not emulating my environment as close as possible locally and in CI/CD.

Construct I am trying to make

This is a basic one I was attempting to narrow things down.

import * as cdk from "@aws-cdk/core";
import * as rds from "@aws-cdk/aws-rds";
import * as ec2 from "@aws-cdk/aws-ec2";
export interface ConstructRdsProps {
  defaultDatabaseName: string;
}
export class ConstructRds extends cdk.Construct {
  public readonly vpc: ec2.Vpc;
  constructor(
    scope: cdk.Construct,
    id: string,
    { defaultDatabaseName }: ConstructRdsProps
  ) {
    super(scope, id);
    // Create the VPC needed for the Aurora DB instance
    const vpc = new ec2.Vpc(this, "RDSVPC");
    const instance = new rds.DatabaseInstance(this, "PostgresRDSInstance", {
      engine: rds.DatabaseInstanceEngine.postgres({
        version: rds.PostgresEngineVersion.VER_12_5,
      }),
      // optional, defaults to m5.large
      instanceType: ec2.InstanceType.of(
        ec2.InstanceClass.BURSTABLE2,
        ec2.InstanceSize.MICRO
      ),
      vpc,
      vpcSubnets: {
        subnetType: ec2.SubnetType.PUBLIC,
      },
      publiclyAccessible: true,
      databaseName: defaultDatabaseName,
    });
    const myUserSecret = new rds.DatabaseSecret(this, "MyUserSecret", {
      username: "myuser",
      secretName: "my-user-secret", // optional, defaults to a CloudFormation-generated name
      masterSecret: instance.secret,
      excludeCharacters: "{}[]()'\"/\\", // defaults to the set " %+~`#$&*()|[]{}:;<>?!'/@\"\\"
    });
    const myUserSecretAttached = myUserSecret.attach(instance); // Adds DB connections information in the secret
    instance.addRotationMultiUser("MyUser", {
      // Add rotation using the multi user scheme
      secret: myUserSecretAttached,
    });
    new cdk.CfnOutput(this, "Password", {
      value: myUserSecret.secretValue.toString() || "",
    });
    new cdk.CfnOutput(this, "InstanceAddress", {
      value: instance.dbInstanceEndpointAddress,
    });
  }
}

Full stack trace

localstack_1  | 2021-04-19T08:52:58:ERROR:cloudformation_api: Exception on / [POST]
localstack_1  | Traceback (most recent call last):
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
localstack_1  |     response = self.full_dispatch_request()
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
localstack_1  |     rv = self.handle_user_exception(e)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack_1  |     return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
localstack_1  |     reraise(exc_type, exc_value, tb)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
localstack_1  |     raise value
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
localstack_1  |     rv = self.dispatch_request()
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
localstack_1  |     return self.view_functions[rule.endpoint](**req.view_args)
localstack_1  |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 744, in handle_request
localstack_1  |     result = func(req_params)
localstack_1  |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 557, in create_change_set
localstack_1  |     template_deployer.prepare_template_body(req_params)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1056, in prepare_template_body
localstack_1  |     return template_preparer.prepare_template_body(req_data)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_preparer.py", line 64, in prepare_template_body
localstack_1  |     modified_template_body = transform_template(req_data)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_preparer.py", line 46, in transform_template
localstack_1  |     transformed = transform_sam(parsed, {}, MockPolicyLoader())
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/translator/transform.py", line 16, in transform
localstack_1  |     return translator.translate(input_fragment, parameter_values=parameter_values, feature_toggle=feature_toggle)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/translator/translator.py", line 104, in translate
localstack_1  |     self.sam_parser.parse(sam_template=sam_template, parameter_values=parameter_values, sam_plugins=sam_plugins)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/parser/parser.py", line 13, in parse
localstack_1  |     sam_plugins.act(LifeCycleEvents.before_transform_template, sam_template)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/plugins/__init__.py", line 139, in act
localstack_1  |     raise ex
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/plugins/__init__.py", line 133, in act
localstack_1  |     getattr(plugin, method_name)(*args, **kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/plugins/application/serverless_app_plugin.py", line 110, in on_before_transform_template
localstack_1  |     service_call(app_id, semver, key, logical_id)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/plugins/application/serverless_app_plugin.py", line 186, in _handle_create_cfn_template_request
localstack_1  |     response = self._sar_service_call(create_cfn_template, logical_id, app_id, semver)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/plugins/application/serverless_app_plugin.py", line 365, in _sar_service_call
localstack_1  |     raise e
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/plugins/application/serverless_app_plugin.py", line 355, in _sar_service_call
localstack_1  |     response = service_call_lambda(*args)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/samtranslator/plugins/application/serverless_app_plugin.py", line 183, in <lambda>
localstack_1  |     create_cfn_template = lambda app_id, semver: self._sar_client.create_cloud_formation_template(
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call
localstack_1  |     return self._make_api_call(operation_name, kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 676, in _make_api_call
localstack_1  |     raise error_class(parsed_response, operation_name)
localstack_1  | botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the CreateCloudFormationTemplate operation: The security token included in the request is invalid.

Environment

$ env | grep AWS
AWS_VAULT=default
AWS_DEFAULT_REGION=us-west-1
AWS_REGION=us-west-1
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test

$ localstack -v
0.12.9.1

$ docker images   
REPOSITORY                      TAG          IMAGE ID       CREATED        SIZE
localstack/localstack           latest       a3e8ad4dd397   2 days ago     683MB

$ docker image inspect localstack/localstack 
# some code omitted
"LOCALSTACK_BUILD_DATE=2021-04-18",
"LOCALSTACK_BUILD_GIT_HASH=b0a496ac",

Other potentially useful tidbits:

  • I am using the awscli installed locally (and not the AWS CLI Docker image).
  • I set my env using aws-vault

--no-version-reporting --no-check-update flags not working

Hi,

cdk will try to recommend version upgrades by invoking "npm view version cdk-core" outputing:

  **************************************************
  *** Newer version of CDK is available [1.91.0] ***
  *** Upgrade recommended                        ***
  **************************************************

cdk also supports flags to skip this, but cdklocal doesn't seem to be working with those.

Is this possibly an issue with cdklocal or is our usage just wrong?

Thanks,

Patrick

LOC-49 ⁃ AWS cloudformation 503 (Service Unavailable)

My serverless.yml file worked with deploys directly to AWS, but adding the serverless-localstack plugin breaks deploys. I have tried the example service files included in here too and got same error below:

Serverless: Invoke aws:deploy:deploy
Serverless: [AWS cloudformation 503 0.702s 3 retries] describeStacks({ StackName: 'serverless-demo-local' })
Serverless: Recoverable error occurred (Service Unavailable), sleeping for 5 seconds. Try 1 of 4
Serverless: [AWS cloudformation 503 0.916s 3 retries] describeStacks({ StackName: 'serverless-demo-local' })
Serverless: Recoverable error occurred (Service Unavailable), sleeping for 5 seconds. Try 2 of 4
Serverless: [AWS cloudformation 503 0.981s 3 retries] describeStacks({ StackName: 'serverless-demo-local' })
Serverless: Recoverable error occurred (Service Unavailable), sleeping for 5 seconds. Try 3 of 4
Serverless: [AWS cloudformation 503 1.017s 3 retries] describeStacks({ StackName: 'serverless-demo-local' })
Serverless: Recoverable error occurred (Service Unavailable), sleeping for 5 seconds. Try 4 of 4
Serverless: [AWS cloudformation 503 0.863s 3 retries] describeStacks({ StackName: 'serverless-demo-local' })

Current docker-compose.yml looks like this:

version: '2.1'

services:
  localstack:
    image: localstack/localstack
    ports:
      - "4567-4593:4567-4593"
      - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
    environment:
      - SERVICES=serverless,cloudformation,iam,sts
      - DEBUG=1
      - LAMBDA_EXECUTOR=docker
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

Localstack cloudformation seems to be running fine:

aws cloudformation describe-stacks --endpoint "http://localhost:4581" --region us-west-2
{
    "Stacks": []
}

Is anyone familiar with the error?

┆Issue is synchronized with this Jira Task by Unito

cdklocal bootstrap fails complaining about StagingBucket

Description

When trying to prepare the LocalStack service for CDK, the cdklocal bootstrap seems to fail:

$ cdklocal bootstrap
 ⏳  Bootstrapping environment aws://000000000000/eu-central-1...
CDKToolkit: creating CloudFormation changeset...
[··························································] (0/3)

   Environment aws://000000000000/eu-central-1 failed bootstrapping: Error [ValidationError]: Template error: resource StagingBucket does not support attribute type RegionalDomainName in Fn::GetAtt
    at Request.extractError (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/protocol/query.js:50:29)
    at Request.callListeners (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/request.js:690:12)
    at Request.callListeners (/home/tehnix/GitHub/codetalkio/patterns-serverless-rust-minimal/node_modules/aws-cdk/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  code: 'ValidationError',
  time: 2020-10-18T20:14:26.279Z,
  requestId: undefined,
  statusCode: 400,
  retryable: false,
  retryDelay: 953.511101390292
}
Template error: resource StagingBucket does not support attribute type RegionalDomainName in Fn::GetAtt

Not really sure where to dig for more information at the moment. For reference I'm running it against a a dockerized LocalStack ([using the standard docker-compose.yml setup).

  • cdklocal version 1.65.0
  • cdk version 1.65.0 (tested with 1.68.0 also)

running cdklocal with solution constructs on localstack

Is it possible to run cdklocal with solution constructs at all? I created a sample cdklocal app with cdklocal init and added the aws @aws-solutions-constructs/aws-apigateway-lambda solution construct. Started the default localstack server and ran cdklocal with the default cdklocal init example first. That worked so I know the setup works. The moment I switch over to the @aws-solutions-constructs/aws-apigateway-lambda solution construct I'm getting a Missing required parameter in input: "logGroupName". I've added a loggroupname on the apigatewway props function, to no success. Console message and code excerpt attached:


console message:

Missing required parameter in input: "logGroupName"
2021-02-16T06:10:07:ERROR:cloudformation_api: Exception on / [POST]
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 548, in handle_request
result = func(req_params)
File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 439, in execute_change_set
deployer.apply_change_set(change_set)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1742, in apply_change_set
change_set.changes = self.apply_changes(change_set.stack, change_set, stack_name=change_set.stack_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1959, in apply_changes
return self.apply_changes_in_loop(changes, old_stack, stack_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1995, in apply_changes_in_loop
self.apply_change(change, stack, new_resources, stack_name=stack_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 2043, in apply_change
result = deploy_resource(resource_id, new_resources, stack_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1196, in deploy_resource
return execute_resource_action(resource_id, resources, stack_name, ACTION_CREATE)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1269, in execute_resource_action
result = configure_resource_via_sdk(resource_id, resources, resource_type, func, stack_name, action_name)
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1378, in configure_resource_via_sdk
raise e
File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1375, in configure_resource_via_sdk
result = function(**params)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 648, in _make_api_call
request_dict = self._convert_to_request_dict(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 696, in _convert_to_request_dict
request_dict = self._serializer.serialize_to_request(
File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/validate.py", line 293, in serialize_to_request
raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Missing required parameter in input: "logGroupName"


Code

     import { ApiGatewayToLambda } from '@aws-solutions-constructs/aws-apigateway-lambda';
      const devLogGroup = new cwlogs.LogGroup(this, "DevLogs",{
        logGroupName:'DevLogs'
    });
    const apigatewaylambda = new ApiGatewayToLambda(this, props.restApiID, {
        lambdaFunctionProps: {
            code: lambda.Code.fromAsset(`${__dirname}/lambdacode.zip`), 
            runtime: lambda.Runtime.NODEJS_12_X,
            functionName: 'getSpatDataTest',
            handler: 'main',
            memorySize: memsize,
            timeout: cdk.Duration.seconds(timeout)
        },
        apiGatewayProps: {
            proxy: true,
            deployOptions: {
                stageName: 'dev',
                accessLogDestination: new apigateway.LogGroupLogDestination(devLogGroup)

            },
            deploy: true,
            restApiName: props.restApiName,
            defaultMethodOptions: {
                apiKeyRequired: false,
                authorizationType: AuthorizationType.NONE,
            },
            binaryMediaTypes: ['*/*']
        }

    });

LOC-37 ⁃ 500 error deploying locally, deploys to AWS just fine

It appears that its failing on the call to updateStack()

AttributeError: 'NoneType' object has no attribute 'value'
2020-03-08T21:03:55:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response from CloudFormation (500) POST /: 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'
2020-03-08 21:03:55,380:API: Error on request:
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 323, in run_wsgi
    execute(self.server.app)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 312, in execute
    application_iter = app(environ, start_response)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/server.py", line 135, in __call__
    return backend_app(environ, start_response)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/utils.py", line 146, in __call__
    result = self.callback(request, request.url, {})
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 197, in dispatch
    return cls()._dispatch(*args, **kwargs)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 295, in _dispatch
    return self.call_action()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 380, in call_action
    response = method()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/responses.py", line 268, in update_stack
    stack_body = self._get_stack_from_s3_url(template_url)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/responses.py", line 40, in _get_stack_from_s3_url
    return key.value.decode("utf-8")

┆Issue is synchronized with this Jira Task by Unito

Can't deploy my cdk stack

I am new to cdk and this is the error message i am getting. Let me know if you need more info:

localstack_1  | 2021-01-23T17:03:28:INFO:localstack.utils.cloudformation.template_deployer: Updating resource apiv1OPTIONS44612F12 of type ApiGateway::Method
localstack_1  | 2021-01-23T17:03:28:INFO:localstack.utils.cloudformation.template_deployer: Unable to apply change set CDK-e97a2753-62b8-4b06-9ba3-9b0ff8df78fd: Parameter validation failed:
localstack_1  | Invalid type for parameter integrationHttpMethod, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
localstack_1  | Invalid type for parameter uri, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
localstack_1  | 2021-01-23T17:03:28:ERROR:cloudformation_api: Exception on / [POST]
localstack_1  | Traceback (most recent call last):
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
localstack_1  |     response = self.full_dispatch_request()
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
localstack_1  |     rv = self.handle_user_exception(e)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
localstack_1  |     return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
localstack_1  |     reraise(exc_type, exc_value, tb)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
localstack_1  |     raise value
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
localstack_1  |     rv = self.dispatch_request()
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
localstack_1  |     return self.view_functions[rule.endpoint](**req.view_args)
localstack_1  |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 548, in handle_request
localstack_1  |     result = func(req_params)
localstack_1  |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_api.py", line 439, in execute_change_set
localstack_1  |     deployer.apply_change_set(change_set)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1743, in apply_change_set
localstack_1  |     change_set.changes = self.apply_changes(change_set.stack, change_set, stack_name=change_set.stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1960, in apply_changes
localstack_1  |     return self.apply_changes_in_loop(changes, old_stack, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1996, in apply_changes_in_loop
localstack_1  |     self.apply_change(change, stack, new_resources, stack_name=stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 2048, in apply_change
localstack_1  |     result = update_resource(resource_id, new_resources, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1170, in update_resource
localstack_1  |     return instance.update_resource(resource, stack_name=stack_name, resources=resources)
localstack_1  |   File "/opt/code/localstack/localstack/services/cloudformation/service_models.py", line 578, in update_resource
localstack_1  |     return client.put_integration(**kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call
localstack_1  |     return self._make_api_call(operation_name, kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 648, in _make_api_call
localstack_1  |     request_dict = self._convert_to_request_dict(
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 696, in _convert_to_request_dict
localstack_1  |     request_dict = self._serializer.serialize_to_request(
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/validate.py", line 297, in serialize_to_request
localstack_1  |     raise ParamValidationError(report=report.generate_report())
localstack_1  | botocore.exceptions.ParamValidationError: Parameter validation failed:
localstack_1  | Invalid type for parameter integrationHttpMethod, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
localstack_1  | Invalid type for parameter uri, value: None, type: <class 'NoneType'>, valid types: <class 'str'>

LOC-47 ⁃ Unable to create environment variable using serverless-localstack

I am unable to get environment variable to work in serverless-localstack.

provider:

name: aws
environment:
  helloworld: ${file(env.yml):{self:provider.stage}.hello

I am trying to set environment variable using env.yml file. Please let me know if this is a known issue and what is the work around to import environment variables

┆Issue is synchronized with this Jira Task by Unito

LOC-22 ⁃ Trouble with provisioning Lambda

Hey, awesome project, can't wait to get it working

I have a simple cdk template for a Lambda stack based off of the TestStack provided by aws-cdk-local:

Template
const cdk = require("@aws-cdk/core");
const lambda = require("@aws-cdk/aws-lambda");
const path = require("path");

class LambdaStack extends cdk.Stack {
  /**
   * @param {cdk.App} scope
   * @param {string} id
   * @param {cdk.StackProps=} props
   */
  constructor(scope, id, props) {
    super(scope, id, props);

    new lambda.Function(this, "MyCdkFunction", {
      runtime: lambda.Runtime.NODEJS_12_X,
      handler: "index.handler",
      code: lambda.Code.fromAsset(
        path.join(__dirname, "./functions/helloWorld")
      )
    });
  }
}

module.exports = { LambdaStack };

I ran cdklocal bootstrap as a requirement of creating an S3 bucket to upload the asset to.

Then, I ran cdklocal deploy and all seems well:

Deploy output
(node:42109) ExperimentalWarning: The fs.promises API is experimental
This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:

IAM Statement Changes
┌───┬──────────────────────────────────┬────────┬────────────────┬──────────────────────────────┬───────────┐
│   │ Resource                         │ Effect │ Action         │ Principal                    │ Condition │
├───┼──────────────────────────────────┼────────┼────────────────┼──────────────────────────────┼───────────┤
│ + │ ${MyCdkFunction/ServiceRole.Arn} │ Allow  │ sts:AssumeRole │ Service:lambda.amazonaws.com │           │
└───┴──────────────────────────────────┴────────┴────────────────┴──────────────────────────────┴───────────┘
IAM Policy Changes
┌───┬──────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
│   │ Resource                     │ Managed Policy ARN                                                             │
├───┼──────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ + │ ${MyCdkFunction/ServiceRole} │ arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole │
└───┴──────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Do you wish to deploy these changes (y/n)? y
LambdaStack: deploying...
[0%] start: Publishing 6f8229de3e2b9365627caceef4302866d709139f4656d8b5e887e8e48e83e362:current
[100%] success: Published 6f8229de3e2b9365627caceef4302866d709139f4656d8b5e887e8e48e83e362:current
LambdaStack: creating CloudFormation changeset...
[··························································] (0/4)


 ✅  LambdaStack

Stack ARN:
arn:aws:cloudformation:us-east-1:000000000000:stack/LambdaStack/fb30a692-bb5a-4a29-b474-3f1c83e8def2

The lambda stack appears in my localstack cloud dashboard

image

However, nothing appears in functions

image

And the following returns no results:

$ awslocal lambda list-functions

{
    "Functions": []
}

I tried to make a change to the function and redeploy it, and got this message:

 LambdaStack failed: Missing Parameter: Missing parameter AssetParametersb5f1908c5949d9b30e17a8f5c68ce01e0938d296338da3108b88097945ef6395S3Bucket4CA074F4

I've attempted to delete my cdk.out folder, destroy and then deploy again, but no success.

Any advice is appreciated! Let me know if I can provide more information.

┆Issue is synchronized with this Jira Bug by Unito

CDK Toolkit bucket URL is wrong for large template files

When a stack getting big, the cloudformation template gets deployed to cdk toolkit bucket and then the url used for cloudformation. AWS-CDK-local does not work under this circumstance, as the bucket URL is not constructed correctly.

Previously that was addressed by the following piece of code

Object.defineProperty(ToolkitInfo.prototype, 'bucketUrl', {
  get() {
    const bucket = this.requireOutput(BUCKET_NAME_OUTPUT);
    const domain = this.requireOutput(BUCKET_DOMAIN_NAME_OUTPUT) || getLocalHost();
    return `https://${domain.replace(`${bucket}.`, '')}/${bucket}`
  }
});

But the newer version of CDK has changed the implementation of "ToolkitInfo" class to be an abstract class which has been implemented by "ExistingToolkitInfo". see

Unfortunately "ExistingToolkitInfo" is not a exported class and it is not accessible to be overriden like the above example.

Another issue is the bucketUrl should include the port number (4566) for it to work.

LOC-26 ⁃ API Gateway inconsistencies

So I'm working with the latest docker image for localstack and latest npm for serverless-localstack and I've noticed three issues with the API Gateway implementation that impact the ability to use it for local testing.

  1. Header parameter casing is changed. What I mean by this is if you send in something like X-USERID localstack converts this to X-Userid. In AWS it retains the casing
  2. Overlapping http paths are not predictable. I have 2 paths, /photos/{photoId} and /photos/upload. In AWS if I send in /photos/upload it will use the right one, with localstack it will sometimes use /photos/{photoId} for this and pass in "upload" s the photoId.
  3. s3 handler events do not get added to the s3 bucket. I created a lambda handler for s3:ObjectCreated:* and then used the cli to check if it was attached and it was not there. I could add this manually and it works as expected but the event in serverless.yml should also add it.

Thanks for the great work with this. It really moves closer to doing some solid testing before production deployment.

┆Issue is synchronized with this Jira Task by Unito

Install instructions incorrect

I think your installation instructions are incorrect
npm install aws-cdk-local aws-cdk
should be install the dependencies globally (at least that was what worked or me)
npm install -g aws-cdk-local aws-cdk

LOC-29 ⁃ 'uname' is not recognized as an internal or external command

serverless deploy -s local:

Serverless: Using serverless-localstack
Serverless: Starting LocalStack in Docker. This can take a while.

  Error --------------------------------------------------

  Error: Command failed: localstack infra start --docker
  'uname' is not recognized as an internal or external command,
  operable program or batch file.
  2020-07-22T14:28:08:DEBUG:bootstrap.py: Unable to load plugins from module C:\Python38\lib\site-packages\localstack_ext\plugins.py: invalid syntax (<string>, line 1)
  2020-07-22T14:28:08:DEBUG:bootstrap.py: Unable to load plugins from module C:\Python38\lib\site-packages\localstack\plugins.py: invalid syntax (<string>, line 1)
  2020-07-22T14:28:08:DEBUG:bootstrap.py: Unable to load plugins from module C:\Python38\lib\site-packages\localstack_ext\plugins.py: invalid syntax (<string>, line 1)
  2020-07-22T14:28:08:DEBUG:bootstrap.py: Unable to load plugins from module C:\Python38\lib\site-packages\localstack\plugins.py: invalid syntax (<string>, line 1)
  'uname' is not recognized as an internal or external command,
  operable program or batch file.
  'uname' is not recognized as an internal or external command,
  operable program or batch file.

      at ChildProcess.exithandler (child_process.js:303:12)
      at ChildProcess.emit (events.js:315:20)
      at ChildProcess.EventEmitter.emit (domain.js:482:12)
      at maybeClose (internal/child_process.js:1021:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

Environment:

Operating System:          win32
     Node Version:              12.18.2
     Framework Version:         1.75.1
     Plugin Version:            3.6.16
     SDK Version:               2.3.1
     Components Version:        2.32.0

┆Issue is synchronized with this Jira Task by Unito

LOC-41 ⁃ Cloudwatch event schedule not working.

I am trying to create a ruby lambda and linking it to an event schedule which is set to trigger every minute.
Lambda is working properly. I am able to deploy and invoke as expected.
But, the event rule is not created.
I tried the same serverless configuration on AWS without localstack, it works.
Please help me to resolve this

serverless.yml:

service: reminders

provider:
  name: aws
  runtime: ruby2.5

plugins:
  - serverless-localstack
  - serverless-ruby-package

custom:
  rubyPackage:
    alwaysCrossCompileExtensions: true
  localstack:
    stages:
      - dev
    host: http://serverless-localstack
    lambda:
      mountCode: False

package:
  excludeDevDependencies: false
  include:
    - lib/**

functions:
  confirmSchoolReminder:
    handler: lib/confirm_school_reminder.ConfirmSchoolReminder.perform
    events:
      - schedule: rate(1 minute)

sls deploy --stage dev:

sls invoke local -f confirmSchoolReminder:

ws events list-rules --endpoint http://serverless-localstack:4587 --region us-east-1:

┆Issue is synchronized with this Jira Task by Unito

latest cdklocal/localstack fails to bootstrap

I upgraded cdklocal and localstack

I'm running localstack on Windows 10 . Below are the versions of the tools

$ cdklocal --version
1.77.0 (build a941c53)
$ docker images | grep localstack
localstack/localstack                  latest                  25b151909437        58 minutes ago      638MB
$ localstack --version
0.12.2

I have started localstack by running

$ localstack start

Then when I run

$ cdklocal bootstrap

I get the following errors

 ⏳  Bootstrapping environment aws://000000000000/eu-central-1...
CDKToolkit: creating CloudFormation changeset...
 0/3 | 14:00:48 | REVIEW_IN_PROGRESS   | AWS::CloudFormation::Stack | CDKToolkit User Initiated
 0/3 | 14:00:48 | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack | CDKToolkit 
 0/3 | 14:00:48 | UPDATE_IN_PROGRESS   | AWS::CloudFormation::Stack | CDKToolkit
 0/3 | 14:00:48 | UPDATE_COMPLETE      | AWS::CloudFormation::Stack | CDKToolkit
 0/3 | 14:00:48 | CREATE_COMPLETE      | AWS::CloudFormation::Stack | CDKToolkit 
 0/3 | 14:00:48 | CREATE_COMPLETE      | AWS::CloudFormation::Stack | CDKToolkit
 0/3 | 14:00:48 | CREATE_FAILED        | AWS::CloudFormation::Stack | CDKToolkit
 ❌  Environment aws://000000000000/eu-central-1 failed bootstrapping: Error: The stack named CDKToolkit failed to deploy: CREATE_FAILED
    at Object.waitForStackDeploy (C:\Users\lwong1\.npm-packages\node_modules\aws-cdk\lib\api\util\cloudformation.ts:307:11)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at Object.deployStack (C:\Users\lwong1\.npm-packages\node_modules\aws-cdk\lib\api\deploy-stack.ts:283:26)
    at C:\Users\lwong1\.npm-packages\node_modules\aws-cdk\lib\cdk-toolkit.ts:358:24
    at async Promise.all (index 0)
    at CdkToolkit.bootstrap (C:\Users\lwong1\.npm-packages\node_modules\aws-cdk\lib\cdk-toolkit.ts:355:5)
    at initCommandLine (C:\Users\lwong1\.npm-packages\node_modules\aws-cdk\bin\cdk.ts:201:9)
The stack named CDKToolkit failed to deploy: CREATE_FAILED

Prior to upgrading localstack it was still working.
But perhaps this issue has the same cause as #5 ?

LOC-21 ⁃ Unable to perform bootstrap command with version 1.71.0 on WSL

Hello - I am seeing an issue with resolving credentials during cdklocal bootstrap: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment after trying this out today on WSL 1. I saw #2 but opened a new issue since the OP of that one mentioned it had worked in the past for them, whereas this was a fresh install for me.

I was following the CDK Example Workshop so my project is about as bare-bones as you can get. I'd appreciate any insight.

$ npm install aws-cdk-local
...
$ cdklocal --version 
1.71.0 (build 953bc25)
$ aws --version
aws-cli/2.0.59 Python/3.7.3 Linux/4.4.0-17763-Microsoft exe/x86_64.ubuntu.18
$ docker images | grep localstack
localstack/localstack     latest              abd9bf591dfd        28 hours ago        839MB
$ SERVICES=serverless,sqs,sns,sts localstack start

... new prompt

$ mkdir cdk-local-ws
$ cd cdk-local-ws
$ cdklocal init sample-app --language=typescript
$ cdklocal synth
...
$ cdklocal bootstrap
Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

My ~/.aws/credentials (I only use AWS Local):

[default]
aws_access_key_id = dummy
aws_secret_access_key = dummy

My ~/.aws/config:

[default]
region = us-east-1
output = json

Any thoughts are appreciated! Let me know if I can provide more information.

┆Issue is synchronized with this Jira Bug by Unito

Unable to resolve AWS account to use

Hi,

I noticed you released 1.65.0. I have been using 1.64.1-dev1 without issue. After upgrading, I'm now getting the following error when bootstrapping:

Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

When I deploy I get:

MarlonBrando-Localstack-Core failed: Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment
    at SdkProvider.resolveEnvironment (/home/jleckenby/Development/pimberly/marlon-brando-monorepo/node_modules/aws-cdk/lib/api/aws-auth/sdk-provider.ts:178:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at CloudFormationDeployments.prepareSdkFor (/home/jleckenby/Development/pimberly/marlon-brando-monorepo/node_modules/aws-cdk/lib/api/cloudformation-deployments.ts:212:33)
    at CloudFormationDeployments.deployStack (/home/jleckenby/Development/pimberly/marlon-brando-monorepo/node_modules/aws-cdk/lib/api/cloudformation-deployments.ts:149:70)
    at CdkToolkit.deploy (/home/jleckenby/Development/pimberly/marlon-brando-monorepo/node_modules/aws-cdk/lib/cdk-toolkit.ts:180:24)
    at initCommandLine (/home/jleckenby/Development/pimberly/marlon-brando-monorepo/node_modules/aws-cdk/bin/cdk.ts:197:9)
Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

Normal CDK bootstrap works fine.

Cannot deploy Fargate

After synthesising, I cannot successfully deploy to ECS on LocalStack. I am running the Pro version of LocalStack. Stack runs on AWS.

CDK Stack

import * as cdk from "@aws-cdk/core";
import * as ec2 from "@aws-cdk/aws-ec2";
import * as ecs from "@aws-cdk/aws-ecs";
import * as ecs_patterns from "@aws-cdk/aws-ecs-patterns";
import "dotenv/config";

export class HelloDatadogFargateStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const vpc = new ec2.Vpc(this, "MyVpc");

    const cluster = new ecs.Cluster(this, "MyCluster", {
      vpc: vpc,
    });

    // Create a load-balanced Fargate service and make it public
    const fargate = new ecs_patterns.ApplicationLoadBalancedFargateService(
      this,
      "MyFargateService",
      {
        cluster: cluster, // Required
        cpu: 256, // Default is 256
        desiredCount: 1, // Default is 1
        taskImageOptions: {
          image: ecs.ContainerImage.fromRegistry(
            "amazon/amazon-ecs-sample"
          ),
        },
        memoryLimitMiB: 512, // Default is 512
        publicLoadBalancer: true, // Default is false
      }
    );
  }
}

Stack Trace

localstack_1  | 2021-05-26T03:09:29:DEBUG:localstack.utils.cloudformation.template_deployer: Error applying changes for CloudFormation stack "HelloDatadogFargateStack": Parameter validation failed:
localstack_1  | Missing required parameter in input: "Name" Traceback (most recent call last):
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1825, in _run
localstack_1  |     self.do_apply_changes_in_loop(changes, stack, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1876, in do_apply_changes_in_loop
localstack_1  |     self.apply_change(change, stack, new_resources, stack_name=stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1929, in apply_change
localstack_1  |     result = deploy_resource(resource_id, new_resources, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 937, in deploy_resource
localstack_1  |     return execute_resource_action(resource_id, resources, stack_name, ACTION_CREATE)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1041, in execute_resource_action
localstack_1  |     result = configure_resource_via_sdk(resource_id, resources, resource_type, func, stack_name, action_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1164, in configure_resource_via_sdk
localstack_1  |     raise e
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1159, in configure_resource_via_sdk
localstack_1  |     result = function(**params)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 386, in _api_call
localstack_1  |     return self._make_api_call(operation_name, kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 677, in _make_api_call
localstack_1  |     request_dict = self._convert_to_request_dict(
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 725, in _convert_to_request_dict
localstack_1  |     request_dict = self._serializer.serialize_to_request(
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/validate.py", line 293, in serialize_to_request
localstack_1  |     raise ParamValidationError(report=report.generate_report())
localstack_1  | botocore.exceptions.ParamValidationError: Parameter validation failed:
localstack_1  | Missing required parameter in input: "Name"
localstack_1  | 
localstack_1  | 2021-05-26T03:09:30:DEBUG:localstack.services.cloudformation.cloudformation_api: Unable to resolve references in stack outputs: {'Value': {'Fn::GetAtt': ['MyFargateServiceLBDE830E97', 'DNSName']}} - Unable to fetch details for resource "MyFargateServiceLBDE830E97" (resolving attribute "DNSName")
localstack_1  | 2021-05-26T03:09:30:DEBUG:localstack.services.cloudformation.cloudformation_api: Unable to resolve references in stack outputs: {'Value': {'Fn::Join': ['', ['http://', {'Fn::GetAtt': ['MyFargateServiceLBDE830E97', 'DNSName']}]]}} - Unable to fetch details for resource "MyFargateServiceLBDE830E97" (resolving attribute "DNSName")
localstack_1  | 2021-05-26T03:09:30:DEBUG:localstack.services.cloudformation.cloudformation_api: Unable to resolve references in stack outputs: {'Value': {'Fn::GetAtt': ['MyFargateServiceLBDE830E97', 'DNSName']}} - Unable to fetch details for resource "MyFargateServiceLBDE830E97" (resolving attribute "DNSName")

deployment error

❌ ... (vector-tpe-dynamodb-interface-service-DeploymentStack) failed: Error: vector-tpe-dynamodb-interface-service-DeploymentStack:
at CloudFormationDeployments.validateBootstrapStackVersion (/home/leandro/.npm-global/lib/node_modules/aws-cdk/lib/api/cloudformation-deployments.ts:297:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
vector-tpe-dynamodb-interface-service-DeploymentStack:

I'm having this issue when running cdklocal deploy.

LOC-24 ⁃ Unable to trigger lambda from kinesis on local env

Hi
I'm trying to write integration tests for my lambda. Right now I'm using invoke but i wanted to start using deploy function
my serverless.yaml

app: ads-replicator-service
service: replicator

provider:
  name: aws
  runtime: java8
  region: ${self:custom.awsRegion.${self:provider.stage}}
  memorySize: 512
  timeout: 45
  stage: ${opt:stage,'local'}
  iamRoleStatements:
    - Effect: 'Allow'
      Action:
        - 'sqs:GetQueueUrl'
        - 'sqs:SendMessage'
      Resource:
        - 'arn:aws:sqs:us-east-1:000000000000:xandr_gw_queue'
  environment:
    XANDR_GW_QUEUE_NAME: ${self:custom.xandrGwQueuName.${self:provider.stage}}
    AWS_SQS_ENDPOINT: ${self:custom.awsSqsEndpoint.${self:provider.stage}}

functions:
  adsReplicator:
    handler: com.schibsted.advertising.Main::handleRequest
    events:
      - stream:
          type: kinesis
          arn: ${self:custom.kinesisArn.${self:provider.stage}}
          startingPosition: TRIM_HORIZON
          batchSize: 5

package:
  artifact: ./target/scala-2.13/ads-replicator.jar

plugins:
  - serverless-localstack
  - serverless-cloudformation-sub-variables
custom:
  stages:
    - local
    - dev
  xandrGwQueuName:
    local: xandr_gw_queue
    dev: XandrGatewayQueue
  awsSqsEndpoint:
    local: http://localhost:4566
    dev: https://sqs.eu-west-1.amazonaws.com:443
  kinesisArn:
    local: arn:aws:kinesis:us-east-1:000000000000:stream/test_stream
    dev: arn:aws:kinesis:#{AWS::Region}:#{AWS::AccountId}:stream/ads-api-main-autobahn
  awsRegion:
    local: us-east-1
    dev: eu-west-1
  localstack:
    stages:
      - local

and sls deploy --stage local
when i push message to kinesis lambda isn't triggered.
Could you help me in pointing what I'm doing wrong and how should i do it.
Thank you

┆Issue is synchronized with this Jira Task by Unito

LOC-43 ⁃ Error Attempting to Invoke Lambda Using Serverless

I created a simple test function, but when I attempt to invoke it using serverless, I get an error "Function not found: arn:aws:lambda:us-east-1:902088074489:function:localstack-test-local-hello".

I have a feeling that the invoke is actually attempting to invoke the function on AWS and not localstack.

localstack version: 0.9.1
serverless version: 1.44.1
serverless-localstack version: 0.4.15

I am running localstack via the command line.

$ localstack start
Starting local dev environment. CTRL-C to quit.
Starting mock SES (http port 4579)...
Starting mock CloudWatch Logs (http port 4586)...
Starting mock Redshift (http port 4577)...
Starting mock CloudFormation (http port 4581)...
Starting mock Firehose service (http port 4573)...
Starting mock Route53 (http port 4580)...
 * Serving Flask app "firehose_api" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
Starting mock ES service (http port 4578)...
   Use a production WSGI server instead.
 * Debug mode: off
 * Serving Flask app "es_api" (lazy loading)
Starting mock IAM (http port 4593)...
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
Starting mock DynamoDB Streams service (http port 4570)...
Starting mock S3 (http port 4572)...
 * Serving Flask app "ddb_streams_api" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
Starting mock CloudWatch (http port 4582)...
   Use a production WSGI server instead.
 * Debug mode: off
Starting mock DynamoDB (http port 4569)...
Starting mock Kinesis (http port 4568)...
Starting mock SQS (http port 4576)...
Starting mock SSM (http port 4583)...
Starting mock SNS (http port 4575)...
Starting mock API Gateway (http port 4567)...
Starting mock Secrets Manager (http port 4584)...
Starting local Elasticsearch (http port 4571)...
Starting mock STS (http port 4592)...
Starting mock StepFunctions (http port 4585)...
Starting mock Lambda service (http port 4574)...
 * Serving Flask app "lambda_api" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
Ready.

Then I deploy using serverless...

$ SLS_DEBUG=* AWS_PROFILE=kevin sls deploy -s local
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command deploy
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Using serverless-localstack
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:deploy:deploy
Serverless: [AWS cloudformation 400 0.037s 0 retries] describeStacks({ StackName: 'localstack-test-local' })
Serverless: Creating Stack...
Serverless: [AWS cloudformation 200 0.217s 0 retries] createStack({ StackName: 'localstack-test-local',
  OnFailure: 'DELETE',
  Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
  Parameters: [ [length]: 0 ],
  TemplateBody: '{"AWSTemplateFormatVersion":"2010-09-09","Description":"The AWS CloudFormation template for this Serverless application","Resources":{"ServerlessDeploymentBucket":{"Type":"AWS::S3::Bucket","Properties":{"BucketEncryption":{"ServerSideEncryptionConfiguration":[{"ServerSideEncryptionByDefault":{"SSEAlgorithm":"AES256"}}]}}}},"Outputs":{"ServerlessDeploymentBucketName":{"Value":{"Ref":"ServerlessDeploymentBucket"}}}}',
  Tags: [ { Key: 'STAGE', Value: 'local' }, [length]: 1 ] })
Serverless: Checking Stack create progress...
Serverless: [AWS cloudformation 200 0.018s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:123456789:stack/localstack-test-local/7be56736-5b24-4e24-b81d-8d75c90ab431' })
..
Serverless: Stack create finished...
Serverless: [AWS cloudformation 200 0.012s 0 retries] describeStackResource({ StackName: 'localstack-test-local',
  LogicalResourceId: 'ServerlessDeploymentBucket' })
Serverless: [AWS s3 200 0.012s 0 retries] listObjectsV2({ Bucket: 'localstack-test-local-ServerlessDeploymentBucket-198106565693',
  Prefix: 'serverless/localstack-test/local' })
Serverless: [AWS sts 200 0.02s 0 retries] getCallerIdentity({})
Serverless: Uploading CloudFormation file to S3...
Serverless: [AWS s3 200 0.012s 0 retries] putObject({ Body: <Buffer 7b 22 41 57 53 54 65 6d 70 6c 61 74 65 46 6f 72 6d 61 74 56 65 72 73 69 6f 6e 22 3a 22 32 30 31 30 2d 30 39 2d 30 39 22 2c 22 44 65 73 63 72 69 70 74 ... >,
  Bucket: 'localstack-test-local-ServerlessDeploymentBucket-198106565693',
  Key: 'serverless/localstack-test/local/1559580146081-2019-06-03T16:42:26.081Z/compiled-cloudformation-template.json',
  ContentType: 'application/json',
  Metadata: { filesha256: '1MRMtJWEicu14F9WcDfX++YzpoX0drzR3kS8rddlGJw=' } })
Serverless: Uploading artifacts...
Serverless: Uploading service localstack-test.zip file to S3 (3.97 KB)...
Serverless: [AWS s3 200 0.009s 0 retries] putObject({ Body: <Buffer 50 4b 03 04 14 00 08 00 08 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 69 6e 64 65 78 2e 6a 73 05 c1 31 0a 80 30 0c 05 d0 bd a7 c8 ... >,
  Bucket: 'localstack-test-local-ServerlessDeploymentBucket-198106565693',
  Key: 'serverless/localstack-test/local/1559580146081-2019-06-03T16:42:26.081Z/localstack-test.zip',
  ContentType: 'application/zip',
  Metadata: { filesha256: '6PjLP1P1qDCdmIUMY2jei5Spbhn6b8Q4Icx4E4EjtMU=' } })
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Updating Stack...
Serverless: [AWS cloudformation 200 0.343s 0 retries] updateStack({ StackName: 'localstack-test-local',
  Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
  Parameters: [ [length]: 0 ],
  TemplateURL: 'https://s3.amazonaws.com/localstack-test-local-ServerlessDeploymentBucket-198106565693/serverless/localstack-test/local/1559580146081-2019-06-03T16:42:26.081Z/compiled-cloudformation-template.json',
  Tags: [ { Key: 'STAGE', Value: 'local' }, [length]: 1 ] })
Serverless: Checking Stack update progress...
Serverless: [AWS cloudformation 200 0.018s 0 retries] describeStackEvents({ StackName: 'arn:aws:cloudformation:us-east-1:123456789:stack/localstack-test-local/7be56736-5b24-4e24-b81d-8d75c90ab431' })
..
Serverless: Stack update finished...
Serverless: Invoke aws:info
Serverless: [AWS cloudformation 200 0.016s 0 retries] describeStacks({ StackName: 'localstack-test-local' })
Serverless: [AWS cloudformation 200 0.009s 0 retries] listStackResources({ StackName: 'localstack-test-local' })
Service Information
service: localstack-test
stage: local
region: us-east-1
stack: localstack-test-local
resources: 5
api keys:
  None
endpoints:
  None
functions:
  hello: localstack-test-local-hello
layers:
  None
Serverless: Invoke aws:deploy:finalize
Serverless: [AWS s3 200 0.042s 0 retries] listObjectsV2({ Bucket: 'localstack-test-local-ServerlessDeploymentBucket-198106565693',
  Prefix: 'serverless/localstack-test/local' })
Serverless Enterprise: Run `serverless login` and deploy again to explore, monitor, secure your serverless project for free.Finally, I attempt to invoke using serverless...```

$ SLS_DEBUG=* AWS_PROFILE=kevin sls invoke -s local -f hello
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command deploy
Serverless: Invoke invoke
Serverless: [AWS lambda 404 0.311s 0 retries] invoke({ FunctionName: 'localstack-test-local-hello',
InvocationType: 'RequestResponse',
LogType: 'None',
Payload: 'SensitiveInformation' })

Serverless Error ---------------------------------------

Function not found: arn:aws:lambda:us-east-1:902088074489:function:localstack-test-local-hello

Stack Trace --------------------------------------------

ServerlessError: Function not found: arn:aws:lambda:us-east-1:902088074489:function:localstack-test-local-hello
at promise.catch.err (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:302:11)
at
at process._tickDomainCallback (internal/process/next_tick.js:228:7)

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information ---------------------------
OS: darwin
Node Version: 8.10.0
Serverless Version: 1.44.1


My serverless.yml...

service: localstack-test

provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, 'dev'}

plugins:

  • serverless-localstack

custom:
localstack:
host: http://localhost
autostart: false
stages:
- local
lambda:
mountCode: false

functions:
hello:
handler: index.handler


I appreciate any help you can provide. Thanks!



┆Issue is synchronized with this [Jira Task](https://localstack.atlassian.net/browse/LOC-43) by [Unito](https://www.unito.io/learn-more)

LOC-40 ⁃ Use `docker-compose.yml` for `autostart: true`

The current implementation depends on user having to install localstack binary on their machine since it uses the following command (https://github.com/localstack/serverless-localstack/blob/master/src/index.js#L332) to start docker container.

localstack infra start --docker

This repo comes with a docker-compose.yml but it's not used at all.

IMHO, when auto-starting it should use the docker-compose.yml as the default way to start docker container. The reason being, I want to use locastack but I don't want to install the binary locally on my machine. That's the essence of using docker containers.

┆Issue is synchronized with this Jira Task by Unito

Unable to run CDK local Error: Cannot find module 'aws-cdk/lib/api/aws-auth/sdk-provider'

Trying to run cdklocal (having used npm to install it) and get the following error:

node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module 'aws-cdk/lib/api/aws-auth/sdk-provider'
Require stack:
- /usr/local/lib/node_modules/aws-cdk-local/bin/cdklocal
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/aws-cdk-local/bin/cdklocal:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lib/node_modules/aws-cdk-local/bin/cdklocal' ]
}

Note: I'm using cdk with python code (but tried running cdklocal in an empty directory as well).

LOC-36 ⁃ An error occurred (404) when calling the HeadObject operation: Not Found Traceback

While using localstack:0.10.8 , I'm getting an error when trying to put object in the local s3 bucket.
More details:

2020-03-22T11:21:47:ERROR:localstack.services.generic_proxy: Error forwarding request: An error occurred (404) when calling the HeadObject operation: Not Found Traceback (most recent call last):
localstack               |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 303, in forward
localstack               |     updated_response = self.proxy.update_listener.return_response(**kwargs)
localstack               |   File "/opt/code/localstack/localstack/services/s3/s3_listener.py", line 1000, in return_response
localstack               |     fix_range_content_type(bucket_name, path, headers, response)
localstack               |   File "/opt/code/localstack/localstack/services/s3/s3_listener.py", line 380, in fix_range_content_type
localstack               |     result = s3_client.head_object(Bucket=bucket_name, Key=key_name)
localstack               |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
localstack               |     return self._make_api_call(operation_name, kwargs)
localstack               |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 626, in _make_api_call
localstack               |     raise error_class(parsed_response, operation_name)
localstack               | botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found

My code snippet:

file_to_upload = open(file_path, 'rb')
response = s3_client.put_object(
        ACL='public-read-write',
        Body=file_to_upload,
        Bucket=function_s3_bucket,
        Key=function_s3_key
    )

With localstack:0.9.6 I don't get this error and everything works as expected

┆Issue is synchronized with this Jira Task by Unito

LOC-42 ⁃ AttributeError: 'LogGroup' object has no attribute 'get_cfn_attribute'

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

Run cdklocal in AWS CodeBuild. Error: no credentials have been configured

Hi. Sorry for creating an issue. I suspect this is a problem with my setup rather than aws-cdk-local. But I thought you might be able to help me locate the issue.

My Setup

I have a typescript CDK Project which deploys several lambdas to AWS using a CDK pipeline.

I am using aws-cdk-loca and localstack to run some tests in a codebuild action in a CDK pipeline. I want to do this so I can create a local dynamodb stack to run my tests against in the pipeline (before deployment of the real stack).

My Problem

This works fine on my own PC but I am getting the following error from AWS CodeBuild when I run cdklocal bootstrap and cdklocal deploy from my codebuild action. Here is a screenshot

Environment aws://000000000000/ap-southeast-1 failed bootstrapping: Error: Need to perform AWS calls for account 000000000000, but no credentials have been configured.

You can see I even tried setting mock credentials but it didn't help.

For completeness here is my code.

Please could you help me to find the issue. It looks like I am missing some configuration or maybe aws-cdk-local is for some reason trying to access the real amazon services?

Thanks :)

Edit: Problem was I wasn't starting localstack before bootstrapping

LOC-27 ⁃ Option to select services

It would be useful if there was an option to only specify some services, if would be easier to use this plugin if it didnt try to enable (and use) localstack for everything. For instance I looked at using this plugin to do some development against SQS, but decided to write a script to launch the docker file manually because of all the issues regarding the lambda environment not working.

┆Issue is synchronized with this Jira Task by Unito

LOC-20 ⁃ Internal error when bootstraping

$ cdklocal --version
1.72.0 (build c2f38e8)

$ localstack --version
0.12.2

$ cat ~/.aws/credentials
[local]
aws_access_key_id = dummy
aws_secret_access_key = dummy

$ echo $AWS_PROFILE
local

I start localstack like this:

$ SERVICES=serverless,sqs,sns DEFAULT_REGION=eu-west-2 DEBUG=1 localstack start

I run:

$ cdklocal bootstrap -c env=local aws://000000000000/eu-west-2

The logs from localstack are the followings:

2020-11-11T11:48:16:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "DescribeStacks" (400) POST /: b'<ErrorResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">\n  <Error>\n    <Type>Sender</Type>\n    <Code>ValidationError</Code>\n    <Message>Stack with id CDKToolkit does not exist</Message>\n  </Error>\n  <RequestId>cf4c737e-5ae2-11e4-a7c9-ad44eEXAMPLE</RequestId>\n</ErrorResponse>'
2020-11-11T11:48:16:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "DescribeStacks" (400) POST /: b'<ErrorResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">\n  <Error>\n    <Type>Sender</Type>\n    <Code>ValidationError</Code>\n    <Message>Stack with id CDKToolkit does not exist</Message>\n  </Error>\n  <RequestId>cf4c737e-5ae2-11e4-a7c9-ad44eEXAMPLE</RequestId>\n</ErrorResponse>'
2020-11-11T11:48:16:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "CreateChangeSet" (500) POST /: 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'
2020-11-11 11:48:16,640:API: Error on request:
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 323, in run_wsgi
    execute(self.server.app)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/werkzeug/serving.py", line 312, in execute
    application_iter = app(environ, start_response)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/server.py", line 168, in __call__
    return backend_app(environ, start_response)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/utils.py", line 151, in __call__
    result = self.callback(request, request.url, {})
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 202, in dispatch
    return cls()._dispatch(*args, **kwargs)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 312, in _dispatch
    return self.call_action()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/responses.py", line 397, in call_action
    response = method()
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/core/utils.py", line 282, in _wrapper
    response = f(*args, **kwargs)
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/responses.py", line 135, in create_change_set
    parameters = {
  File "/opt/code/localstack/.venv/lib/python3.8/site-packages/moto/cloudformation/responses.py", line 136, in <dictcomp>
    param["parameter_key"]: param["parameter_value"]
KeyError: 'parameter_value'
2020-11-11T11:48:17:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "CreateChangeSet" (500) POST /: 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'

┆Issue is synchronized with this Jira Bug by Unito

LOC-25 ⁃ Deployment to the `localstack` works randomly

I'm encountering an issue where only one deployment out of dozes works correctly.

When I try to call my endpoint:

curl -X POST http://localhost:4566/restapis/<deployment-id>/local/_user_request_/register

then in most cases, this results in an error.

Here are full logs from working deployment - from docker-compose up to API call

localstack_1  | Waiting for all LocalStack services to be ready
localstack_1  | 2020-10-18 15:49:23,632 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
localstack_1  | 2020-10-18 15:49:23,636 INFO supervisord started with pid 13
localstack_1  | 2020-10-18 15:49:24,641 INFO spawned: 'dashboard' with pid 19
localstack_1  | 2020-10-18 15:49:24,645 INFO spawned: 'infra' with pid 20
localstack_1  | 2020-10-18 15:49:24,652 INFO success: dashboard entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
localstack_1  | 2020-10-18 15:49:24,653 INFO exited: dashboard (exit status 0; expected)
localstack_1  | (. .venv/bin/activate; exec bin/localstack start --host)
localstack_1  | LocalStack version: 0.12.0
localstack_1  | Starting local dev environment. CTRL-C to quit.
localstack_1  | 2020-10-18T15:49:25:DEBUG:bootstrap.py: Loading plugins - scope "services", module "localstack": <function register_localstack_plugins at 0x7f2edba83ca0>
localstack_1  | 2020-10-18 15:49:26,473 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
localstack_1  | 2020-10-18T15:49:29:INFO:localstack.utils.analytics.profiler: Execution of "load_plugin_from_path" took 3591.369867324829ms
localstack_1  | 2020-10-18T15:49:29:INFO:localstack.utils.analytics.profiler: Execution of "load_plugins" took 3591.7928218841553ms
localstack_1  | Waiting for all LocalStack services to be ready
localstack_1  | Starting edge router (https port 4566)...
localstack_1  | 2020-10-18T15:49:30:INFO:localstack.utils.analytics.profiler: Execution of "prepare_environment" took 1052.7760982513428ms
localstack_1  | Starting mock API Gateway service on http port 4566 ...
localstack_1  | 2020-10-18T15:49:30:INFO:localstack.multiserver: Starting multi API server process on port 53437
localstack_1  | [2020-10-18 15:49:30 +0000] [21] [INFO] Running on http://0.0.0.0:53437 (CTRL + C to quit)
localstack_1  | 2020-10-18T15:49:30:INFO:hypercorn.error: Running on http://0.0.0.0:53437 (CTRL + C to quit)
localstack_1  | [2020-10-18 15:49:30 +0000] [21] [INFO] Running on https://0.0.0.0:4566 (CTRL + C to quit)
localstack_1  | 2020-10-18T15:49:30:INFO:hypercorn.error: Running on https://0.0.0.0:4566 (CTRL + C to quit)
localstack_1  | Starting mock CloudFormation service on http port 4566 ...
localstack_1  | Starting mock CloudWatch service on http port 4566 ...
localstack_1  | Starting mock DynamoDB service on http port 4566 ...
localstack_1  | Starting mock DynamoDB Streams service on http port 4566 ...
localstack_1  | Starting mock IAM service on http port 4566 ...
localstack_1  | Starting mock STS service on http port 4566 ...
localstack_1  | Starting mock Kinesis service on http port 4566 ...
localstack_1  | Starting mock Lambda service on http port 4566 ...
localstack_1  | Starting mock CloudWatch Logs service on http port 4566 ...
localstack_1  | Starting mock S3 service on http port 4566 ...
localstack_1  | Initializing DynamoDB Local with the following configuration:
localstack_1  | Port:	50673
localstack_1  | InMemory:	true
localstack_1  | DbPath:	null
localstack_1  | SharedDb:	true
localstack_1  | shouldDelayTransientStatuses:	false
localstack_1  | CorsParams:	*
localstack_1  |
localstack_1  | Listening at http://:::36851
localstack_1  | 2020-10-18 15:49:31,363:API:  * Running on http://0.0.0.0:57929/ (Press CTRL+C to quit)
localstack_1  | 2020-10-18 15:49:31,448:API:  * Running on http://0.0.0.0:36943/ (Press CTRL+C to quit)
localstack_1  | Waiting for all LocalStack services to be ready
localstack_1  | Ready.
localstack_1  | 2020-10-18T15:49:41:INFO:localstack.utils.analytics.profiler: Execution of "start_api_services" took 10947.968006134033ms
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "DescribeStacks" (400) POST /: b'<ErrorResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">\n  <Error>\n    <Type>Sender</Type>\n    <Code>ValidationError</Code>\n    <Message>Stack with id newsletter-app-local does not exist</Message>\n  </Error>\n  <RequestId>cf4c737e-5ae2-11e4-a7c9-ad44eEXAMPLE</RequestId>\n</ErrorResponse>'
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ServerlessDeploymentBucket: None
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::S3::Bucket', 'Properties': {'BucketEncryption': {'ServerSideEncryptionConfiguration': [{'ServerSideEncryptionByDefault': {'SSEAlgorithm': 'AES256'}}]}, 'BucketName': 'newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e'}}
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "S3::Bucket" id "ServerlessDeploymentBucket"
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "S3::Bucket" in region us-east-1: create_bucket {'Bucket': 'newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e', 'ACL': 'public-read'}
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ServerlessDeploymentBucketPolicy: None
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::S3::BucketPolicy', 'Properties': {'Bucket': 'newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e', 'PolicyDocument': {'Statement': [{'Action': 's3:*', 'Effect': 'Deny', 'Principal': '*', 'Resource': ['arn:aws:s3:::newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e/*'], 'Condition': {'Bool': {'aws:SecureTransport': False}}}]}}}
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "S3::BucketPolicy" id "ServerlessDeploymentBucketPolicy"
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "S3::BucketPolicy" in region us-east-1: put_bucket_policy {'Bucket': 'newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e', 'Policy': '{"Statement": [{"Action": "s3:*", "Effect": "Deny", "Principal": "*", "Resource": ["arn:aws:s3:::newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e/*"], "Condition": {"Bool": {"aws:SecureTransport": false}}}]}'}
localstack_1  | 2020-10-18T15:50:00:WARNING:localstack.services.cloudformation.cloudformation_starter: Unable to determine physical_resource_id for resource <class 'localstack.services.cloudformation.service_models.S3BucketPolicy'>
localstack_1  | 2020-10-18T15:50:00:DEBUG:localstack.services.cloudformation.cloudformation_starter: Running CloudFormation stack deployment loop iteration 1
localstack_1  | 2020-10-18T15:50:05:WARNING:localstack.services.awslambda.lambda_api: Function not found: arn:aws:lambda:us-east-1:000000000000:function:newsletter-app-local-register
localstack_1  | 2020-10-18T15:50:05:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/RegisterLambdaVersion1DiUbYf41cRntnDPG80oBXDuf5UDLhp6QZQ8ilsR3k: None
localstack_1  | 2020-10-18T15:50:05:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/RegisterLambdaFunction: None
localstack_1  | 2020-10-18T15:50:05:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/IamRoleLambdaExecution: None
localstack_1  | 2020-10-18T15:50:05:DEBUG:localstack.services.cloudformation.cloudformation_starter: Resource IamRoleLambdaExecution need not be deployed (is_updateable=False): {'Type': 'AWS::IAM::Role', 'Properties': {'AssumeRolePolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Effect': 'Allow', 'Principal': {'Service': ['lambda.amazonaws.com']}, 'Action': ['sts:AssumeRole']}]}, 'Policies': [{'PolicyName': 'newsletter-app-local-lambda', 'PolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Effect': 'Allow', 'Action': ['logs:CreateLogStream', 'logs:CreateLogGroup'], 'Resource': ['arn:aws:logs:us-east-1:000000000000:log-group:/aws/lambda/newsletter-app-local*:*']}, {'Effect': 'Allow', 'Action': ['logs:PutLogEvents'], 'Resource': ['arn:aws:logs:us-east-1:000000000000:log-group:/aws/lambda/newsletter-app-local*:*:*']}]}}], 'Path': '/', 'RoleName': 'newsletter-app-local-us-east-1-lambdaRole'}} True
localstack_1  | 2020-10-18T15:50:05:WARNING:localstack.services.awslambda.lambda_api: Function not found: arn:aws:lambda:us-east-1:000000000000:function:newsletter-app-local-register
localstack_1  | 2020-10-18T15:50:05:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::Lambda::Function', 'Properties': {'Code': {'S3Bucket': 'newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e', 'S3Key': 'serverless/newsletter-app/local/1603036200016-2020-10-18T15:50:00.016Z/newsletter-app.zip'}, 'FunctionName': 'newsletter-app-local-register', 'Handler': 'handler.register', 'MemorySize': 1024, 'Role': 'arn:aws:iam::000000000000:role/newsletter-app-local-us-east-1-lambdaRole', 'Runtime': 'nodejs12.x', 'Timeout': 6, 'Environment': {'Variables': {'AWS_NODEJS_CONNECTION_REUSE_ENABLED': '1'}}}, 'DependsOn': ['RegisterLogGroup']}
localstack_1  | 2020-10-18T15:50:05:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "Lambda::Function" id "RegisterLambdaFunction"
localstack_1  | 2020-10-18T15:50:05:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "Lambda::Function" in region us-east-1: create_function {'FunctionName': 'newsletter-app-local-register', 'Runtime': 'nodejs12.x', 'Role': 'arn:aws:iam::000000000000:role/newsletter-app-local-us-east-1-lambdaRole', 'Handler': 'handler.register', 'Code': {'S3Bucket': 'newsletter-app-local-serverlessdeploymentbucket-hd6jkqynky2e', 'S3Key': 'serverless/newsletter-app/local/1603036200016-2020-10-18T15:50:00.016Z/newsletter-app.zip'}, 'Environment': {'Variables': {'AWS_NODEJS_CONNECTION_REUSE_ENABLED': '1'}}, 'Timeout': 6, 'MemorySize': 1024}
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Resource RegisterLambdaVersion1DiUbYf41cRntnDPG80oBXDuf5UDLhp6QZQ8ilsR3k need not be deployed (is_updateable=False): {'Type': 'AWS::Lambda::Version', 'DeletionPolicy': 'Retain', 'Properties': {'FunctionName': 'newsletter-app-local-register', 'CodeSha256': 'B4w4zFpL5b96wC+KezO4nOMWK08QLigxtHNHVi7doUo='}} True
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ApiGatewayMethodRegisterPost: None
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ApiGatewayResourceRegister: None
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ApiGatewayRestApi: None
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::ApiGateway::RestApi', 'Properties': {'Name': 'local-newsletter-app', 'EndpointConfiguration': {'Types': ['EDGE']}, 'Policy': '', 'MinimumCompressionSize': 1024}}
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "ApiGateway::RestApi" id "ApiGatewayRestApi"
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "ApiGateway::RestApi" in region us-east-1: create_rest_api {'name': 'local-newsletter-app'}
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Updating resource id: 608eab7b - yt690zs955, 608eab7b - {'Type': 'AWS::ApiGateway::RestApi', 'Properties': {'Name': 'local-newsletter-app', 'EndpointConfiguration': {'Types': ['EDGE']}, 'Policy': '', 'MinimumCompressionSize': 1024}}
localstack_1  | 2020-10-18T15:50:06:INFO:localstack.services.cloudformation.cloudformation_starter: Updating resource ID from 608eab7b to yt690zs955 (us-east-1)
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::ApiGateway::Resource', 'Properties': {'ParentId': '06ucno224r', 'PathPart': 'register', 'RestApiId': 'yt690zs955'}}
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "ApiGateway::Resource" id "ApiGatewayResourceRegister"
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "ApiGateway::Resource" in region us-east-1: create_resource {'restApiId': 'yt690zs955', 'pathPart': 'register', 'parentId': '06ucno224r'}
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Updating resource id: d78afed8 - mnf7mogao2, <moto.apigateway.models.Resource object at 0x7f2ed548fbb0> - {'Type': 'AWS::ApiGateway::Resource', 'Properties': {'ParentId': '06ucno224r', 'PathPart': 'register', 'RestApiId': 'yt690zs955'}}
localstack_1  | 2020-10-18T15:50:06:INFO:localstack.services.cloudformation.cloudformation_starter: Updating resource ID from d78afed8 to mnf7mogao2 (us-east-1)
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/RegisterLogGroup: None
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Resource RegisterLogGroup need not be deployed (is_updateable=False): {'Type': 'AWS::Logs::LogGroup', 'Properties': {'LogGroupName': '/aws/lambda/newsletter-app-local-register'}} True
localstack_1  | 2020-10-18T15:50:06:WARNING:localstack.services.cloudformation.cloudformation_starter: Unable to determine physical_resource_id for resource <class 'moto.apigateway.models.Resource'>
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::ApiGateway::Method', 'Properties': {'HttpMethod': 'POST', 'RequestParameters': {}, 'ResourceId': 'mnf7mogao2', 'RestApiId': 'yt690zs955', 'ApiKeyRequired': False, 'AuthorizationType': 'NONE', 'Integration': {'IntegrationHttpMethod': 'POST', 'Type': 'AWS_PROXY', 'Uri': 'arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:000000000000:function:newsletter-app-local-register/invocations'}, 'MethodResponses': []}}
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "ApiGateway::Method" id "ApiGatewayMethodRegisterPost"
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "ApiGateway::Method" in region us-east-1: put_method {'restApiId': 'yt690zs955', 'resourceId': 'mnf7mogao2', 'httpMethod': 'POST', 'authorizationType': 'NONE', 'requestParameters': {}}
localstack_1  | 2020-10-18T15:50:06:WARNING:localstack.services.cloudformation.cloudformation_starter: Unable to determine physical_resource_id for resource <class 'moto.apigateway.models.Method'>
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/IamRoleLambdaExecution: True
localstack_1  | 2020-10-18T15:50:06:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ApiGatewayDeployment1603036192856: None
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.utils.cloudformation.template_deployer: Extract resource attribute: ApiGateway::RestApi RootResourceId
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.utils.cloudformation.template_deployer: Extract resource attribute: ApiGateway::Resource PhysicalResourceId
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::ApiGateway::Deployment', 'Properties': {'RestApiId': 'yt690zs955', 'StageName': 'local'}, 'DependsOn': ['ApiGatewayMethodRegisterPost']}
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "ApiGateway::Deployment" id "ApiGatewayDeployment1603036192856"
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "ApiGateway::Deployment" in region us-east-1: create_deployment {'restApiId': 'yt690zs955', 'stageName': 'local'}
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Updating resource id: 6e9e3d02 - fdkpztr76i, {'id': '6e9e3d02', 'stageName': 'local', 'description': '', 'createdDate': 1603036206} - {'Type': 'AWS::ApiGateway::Deployment', 'Properties': {'RestApiId': 'yt690zs955', 'StageName': 'local'}, 'DependsOn': ['ApiGatewayMethodRegisterPost']}
localstack_1  | 2020-10-18T15:50:07:INFO:localstack.services.cloudformation.cloudformation_starter: Updating resource ID from 6e9e3d02 to fdkpztr76i (us-east-1)
localstack_1  | 2020-10-18T15:50:07:WARNING:localstack.services.cloudformation.cloudformation_starter: Unable to determine physical_resource_id for resource <class 'moto.apigateway.models.Deployment'>
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ApiGatewayRestApi: False
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/RegisterLogGroup: True
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ApiGatewayResourceRegister: False
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/RegisterLambdaPermissionApiGateway: None
localstack_1  | 2020-10-18T15:50:07:WARNING:moto: No Moto CloudFormation support for AWS::Lambda::Permission
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/RegisterLambdaFunction: False
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Unable to resolve attribute reference ['IamRoleLambdaExecution', 'Arn'] in resource map keys ['ServerlessDeploymentBucket', 'ServerlessDeploymentBucketPolicy', 'RegisterLogGroup', 'IamRoleLambdaExecution', 'RegisterLambdaFunction', 'RegisterLambdaVersion1DiUbYf41cRntnDPG80oBXDuf5UDLhp6QZQ8ilsR3k', 'ApiGatewayRestApi', 'ApiGatewayResourceRegister', 'ApiGatewayMethodRegisterPost', 'ApiGatewayDeployment1603036192856', 'RegisterLambdaPermissionApiGateway']
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ServerlessDeploymentBucket: False
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=True, exists=False, updateable=False): {'Type': 'AWS::S3::Bucket', 'Properties': {'BucketEncryption': {'ServerSideEncryptionConfiguration': [{'ServerSideEncryptionByDefault': {'SSEAlgorithm': 'AES256'}}]}, 'BucketName': 'newsletter-app-local-serverlessdeploymentbucket-5511xxiqe44l'}}
localstack_1  | 2020-10-18T15:50:07:WARNING:localstack.utils.cloudformation.template_deployer: Unable to update resource type "S3::Bucket", id "ServerlessDeploymentBucket"
localstack_1  | 2020-10-18T15:50:07:DEBUG:localstack.services.cloudformation.cloudformation_starter: Running CloudFormation stack deployment loop iteration 1
localstack_1  | 2020-10-18T15:50:12:WARNING:localstack.services.cloudformation.cloudformation_starter: Unable to resolve "Ref" attribute for: {'Ref': 'RegisterLambdaVersion1DiUbYf41cRntnDPG80oBXDuf5UDLhp6QZQ8ilsR3k'} - RegisterLambdaVersion1DiUbYf41cRntnDPG80oBXDuf5UDLhp6QZQ8ilsR3k - <class 'moto.awslambda.models.LambdaVersion'>
localstack_1  | 2020-10-18T15:51:17:DEBUG:localstack.services.awslambda.lambda_api: Running Lambda function arn:aws:lambda:us-east-1:000000000000:function:newsletter-app-local-register from API Gateway invocation: POST /register
localstack_1  | 2020-10-18T15:51:17:INFO:localstack.services.awslambda.lambda_executors: Determined main container target IP: 172.17.0.2
localstack_1  | 2020-10-18T15:51:17:INFO:localstack.services.awslambda.lambda_executors: Running lambda cmd: CONTAINER_ID="$(docker create -i   -e AWS_NODEJS_CONNECTION_REUSE_ENABLED="$AWS_NODEJS_CONNECTION_REUSE_ENABLED" -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" -e DOCKER_LAMBDA_USE_STDIN="$DOCKER_LAMBDA_USE_STDIN" -e LOCALSTACK_HOSTNAME="$LOCALSTACK_HOSTNAME" -e EDGE_PORT="$EDGE_PORT" -e _HANDLER="$_HANDLER" -e AWS_LAMBDA_FUNCTION_TIMEOUT="$AWS_LAMBDA_FUNCTION_TIMEOUT" -e AWS_LAMBDA_FUNCTION_NAME="$AWS_LAMBDA_FUNCTION_NAME" -e AWS_LAMBDA_FUNCTION_VERSION="$AWS_LAMBDA_FUNCTION_VERSION" -e AWS_LAMBDA_FUNCTION_INVOKED_ARN="$AWS_LAMBDA_FUNCTION_INVOKED_ARN" -e AWS_LAMBDA_COGNITO_IDENTITY="$AWS_LAMBDA_COGNITO_IDENTITY" -e NODE_TLS_REJECT_UNAUTHORIZED="$NODE_TLS_REJECT_UNAUTHORIZED"   --rm "lambci/lambda:nodejs12.x" "handler.register")";docker cp "/tmp/localstack/zipfile.77f5af52/." "$CONTAINER_ID:/var/task"; docker start -ai "$CONTAINER_ID";
localstack_1  | 2020-10-18T15:51:18:DEBUG:localstack.services.awslambda.lambda_executors: Lambda arn:aws:lambda:us-east-1:000000000000:function:newsletter-app-local-register result / log output:
localstack_1  | {"statusCode":200,"body":"{\n  \"message\": \"Go Serverless Webpack (Typescript) v1.0! Your function executed successfully!\",\n  \"input\": {\n    \"path\": \"/register\",\n    \"headers\": {\n      \"Remote-Addr\": \"172.17.0.1\",\n      \"Host\": \"localhost:4566\",\n      \"User-Agent\": \"curl/7.64.1\",\n      \"Accept\": \"*/*\",\n      \"X-Forwarded-For\": \"172.17.0.1, localhost:4566, 127.0.0.1, localhost:4566\",\n      \"x-localstack-edge\": \"https://localhost:4566\",\n      \"Authorization\": \"AWS4-HMAC-SHA256 Credential=LocalStackDummyAccessKey/20160623/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=1234\"\n    },\n    \"multiValueHeaders\": {\n      \"Remote-Addr\": [\n        \"172.17.0.1\"\n      ],\n      \"Host\": [\n        \"localhost:4566\"\n      ],\n      \"User-Agent\": [\n        \"curl/7.64.1\"\n      ],\n      \"Accept\": [\n        \"*/*\"\n      ],\n      \"X-Forwarded-For\": [\n        \"172.17.0.1, localhost:4566, 127.0.0.1, localhost:4566\"\n      ],\n      \"x-localstack-edge\": [\n        \"https://localhost:4566\"\n      ],\n      \"Authorization\": [\n        \"AWS4-HMAC-SHA256 Credential=LocalStackDummyAccessKey/20160623/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=1234\"\n      ]\n    },\n    \"pathParameters\": {},\n    \"body\": \"\",\n    \"isBase64Encoded\": false,\n    \"resource\": \"/restapis/yt690zs955/local/_user_request_/register\",\n    \"httpMethod\": \"POST\",\n    \"queryStringParameters\": {},\n    \"multiValueQueryStringParameters\": {},\n    \"requestContext\": {\n      \"path\": \"/local/register\",\n      \"accountId\": \"000000000000\",\n      \"resourceId\": \"mnf7mogao2\",\n      \"stage\": \"local\",\n      \"identity\": {\n        \"accountId\": \"000000000000\",\n        \"sourceIp\": \"127.0.0.1\",\n        \"userAgent\": \"curl/7.64.1\"\n      },\n      \"httpMethod\": \"POST\",\n      \"protocol\": \"HTTP/1.1\",\n      \"requestTime\": \"2020-10-18T15:51:17.323Z\",\n      \"requestTimeEpoch\": 1603036277323\n    },\n    \"stageVariables\": {}\n  }\n}"}
localstack_1  | > START RequestId: 02991f59-6b7e-11fb-b598-6685b68604ea Version: $LATEST
localstack_1  | > END RequestId: 02991f59-6b7e-11fb-b598-6685b68604ea
localstack_1  | > REPORT RequestId: 02991f59-6b7e-11fb-b598-6685b68604ea	Init Duration: 253.10 ms	Duration: 8.99 ms	Billed Duration: 100 ms	Memory Size: 1536 MB	Max Memory Used: 44 MB
localstack_1  | 2020-10-18T15:51:18:INFO:localstack.services.edge: Unable to find forwarding rule for host "04e6873a557a:4566", path "/", target header "", auth header "", data "b''"
^CGracefully stopping... (press Ctrl+C again to force)

and here are full logs from the broken one:

{code}
Starting newsletter-app_localstack_1 ... done
Attaching to newsletter-app_localstack_1
localstack_1 | Waiting for all LocalStack services to be ready
localstack_1 | 2020-10-18 15:52:10,025 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
localstack_1 | 2020-10-18 15:52:10,029 INFO supervisord started with pid 14
localstack_1 | 2020-10-18 15:52:11,034 INFO spawned: 'dashboard' with pid 20
localstack_1 | 2020-10-18 15:52:11,038 INFO spawned: 'infra' with pid 21
localstack_1 | 2020-10-18 15:52:11,045 INFO success: dashboard entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
localstack_1 | 2020-10-18 15:52:11,046 INFO exited: dashboard (exit status 0; expected)
localstack_1 | (. .venv/bin/activate; exec bin/localstack start --host)
localstack_1 | LocalStack version: 0.12.0
localstack_1 | Starting local dev environment. CTRL-C to quit.
localstack_1 | 2020-10-18T15:52:11:DEBUG:bootstrap.py: Loading plugins - scope "services", module "localstack": <function register_localstack_plugins at 0x7f67048e0ca0>
localstack_1 | 2020-10-18 15:52:12,844 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
localstack_1 | 2020-10-18T15:52:15:INFO:localstack.utils.analytics.profiler: Execution of "load_plugin_from_path" took 3491.328001022339ms
localstack_1 | 2020-10-18T15:52:15:INFO:localstack.utils.analytics.profiler: Execution of "load_plugins" took 3491.597890853882ms
localstack_1 | Waiting for all LocalStack services to be ready
localstack_1 | Starting edge router (https port 4566)...
localstack_1 | Starting mock API Gateway service on http port 4566 ...
localstack_1 | 2020-10-18T15:52:17:INFO:localstack.utils.analytics.profiler: Execution of "prepare_environment" took 2052.669048309326ms
localstack_1 | 2020-10-18T15:52:17:INFO:localstack.multiserver: Starting multi API server process on port 42565
localstack_1 | [2020-10-18 15:52:17 ﹍0000] [22] [INFO] Running on http://0.0.0.0:42565 (CTRL﹍ C to quit)
localstack_1 | 2020-10-18T15:52:17:INFO:hypercorn.error: Running on http://0.0.0.0:42565 (CTRL + C to quit)
localstack_1 | [2020-10-18 15:52:17 ﹍0000] [22] [INFO] Running on https://0.0.0.0:4566 (CTRL﹍ C to quit)
localstack_1 | 2020-10-18T15:52:17:INFO:hypercorn.error: Running on https://0.0.0.0:4566 (CTRL + C to quit)
localstack_1 | Starting mock CloudFormation service on http port 4566 ...
localstack_1 | Starting mock CloudWatch service on http port 4566 ...
localstack_1 | Starting mock DynamoDB service on http port 4566 ...
localstack_1 | Starting mock DynamoDB Streams service on http port 4566 ...
localstack_1 | Starting mock IAM service on http port 4566 ...
localstack_1 | Starting mock STS service on http port 4566 ...
localstack_1 | 2020-10-18 15:52:18,574:API: * Running on http://0.0.0.0:56771/ (Press CTRL+C to quit)
localstack_1 | 2020-10-18 15:52:18,657:API: * Running on http://0.0.0.0:34279/ (Press CTRL+C to quit)
localstack_1 | Starting mock Kinesis service on http port 4566 ...
localstack_1 | Starting mock Lambda service on http port 4566 ...
localstack_1 | Starting mock CloudWatch Logs service on http port 4566 ...
localstack_1 | Starting mock S3 service on http port 4566 ...
localstack_1 | Initializing DynamoDB Local with the following configuration:
localstack_1 | Port: 53093
localstack_1 | InMemory: true
localstack_1 | DbPath: null
localstack_1 | SharedDb: true
localstack_1 | shouldDelayTransientStatuses: false
localstack_1 | CorsParams: *
localstack_1 |
localstack_1 | Listening at http://:::47241
localstack_1 | Waiting for all LocalStack services to be ready
localstack_1 | Ready.
localstack_1 | 2020-10-18T15:52:28:INFO:localstack.utils.analytics.profiler: Execution of "start_api_services" took 10924.87096786499ms
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "DescribeStacks" (400) POST /: b'\n \n Sender\n ValidationError\n Stack with id newsletter-app-local does not exist\n \n cf4c737e-5ae2-11e4-a7c9-ad44eEXAMPLE\n'
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ServerlessDeploymentBucket: None
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::S3::Bucket', 'Properties': {'BucketEncryption': {'ServerSideEncryptionConfiguration': [{'ServerSideEncryptionByDefault': {'SSEAlgorithm': 'AES256'}}]}, 'BucketName': 'newsletter-app-local-serverlessdeploymentbucket-i2ih8b11ngsx'}}
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "S3::Bucket" id "ServerlessDeploymentBucket"
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "S3::Bucket" in region us-east-1: create_bucket {'Bucket': 'newsletter-app-local-serverlessdeploymentbucket-i2ih8b11ngsx', 'ACL': 'public-read'}
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing stack resource newsletter-app-local/ServerlessDeploymentBucketPolicy: None
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::S3::BucketPolicy', 'Properties': {'Bucket': 'newsletter-app-local-serverlessdeploymentbucket-i2ih8b11ngsx', 'PolicyDocument': {'Statement': [{'Action': 's3:', 'Effect': 'Deny', 'Principal': '', 'Resource': ['arn:aws:s3:::newsletter-app-local-serverlessdeploymentbucket-i2ih8b11ngsx/*'], 'Condition': {'Bool': {'aws:SecureTransport': False}}}]}}}
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "S3::BucketPolicy" id "ServerlessDeploymentBucketPolicy"
localstack_1 | 2020-10-18T15:52:47:DEBUG:localstack.utils.cloudfor

┆Issue is synchronized with this Jira Task by Unito

LOC-35 ⁃ serverless deploy fails with 404 'Function not found...'

I'm attempting to create a containerized local dev environment using serverless and localstack. I can run the services using docker-compose, and access both containers, run sls commands, etc. When I try to deploy, it eventually fails with a 404 as mentioned, with these container logs:

ack    | 2020-04-14T19:00:17:INFO:localstack.services.cloudformation.cloudformation_starter: Resource BdpipeLambdaFunction cannot be deployed, found unsatisfied dependencies. {'Type': 'AWS::Lambda::Function', 'Properties': {'Code': {'S3Bucket': '__local__', 'S3Key': '/usr/src/app'}, 'FunctionName': 'api-local-bdpipe', 'Handler': 'src/handlers/bdpipe/handler.bdpipe', 'MemorySize': 1024, 'Role': 'arn:aws:iam::123456789012:role/api-local-us-east-1-lambdaRole', 'Runtime': 'nodejs12.x', 'Timeout': 6}, 'DependsOn': ['BdpipeLogGroup', 'IamRoleLambdaExecution']}
localstack    | 2020-04-14T19:00:17:WARNING:localstack.services.awslambda.lambda_api: Function not found: arn:aws:lambda:us-east-1:000000000000:function:api-local-bdpipe
localstack    | 2020-04-14T19:00:17:DEBUG:localstack.services.cloudformation.cloudformation_starter: Deploying CloudFormation resource (update=False, exists=False, updateable=False): {'Type': 'AWS::Lambda::Version', 'DeletionPolicy': 'Retain', 'Properties': {'FunctionName': 'api-local-bdpipe', 'CodeSha256': 'v7Fnk3nzhFrM3Cu8+79Z9s/bxeV0jJD90uBDvW+/+08='}}
localstack    | 2020-04-14T19:00:17:DEBUG:localstack.utils.cloudformation.template_deployer: Running action "create" for resource type "Lambda::Version" id "BdpipeLambdaVersionUqVEqKWOcJPDf9qm4UPGlmcvUxD3pvE95yVtV3biwpg"
localstack    | 2020-04-14T19:00:17:DEBUG:localstack.utils.cloudformation.template_deployer: Request for resource type "Lambda::Version" in region us-east-1: publish_version {'FunctionName': 'api-local-bdpipe', 'CodeSha256': 'v7Fnk3nzhFrM3Cu8+79Z9s/bxeV0jJD90uBDvW+/+08='}
localstack    | 2020-04-14T19:00:17:WARNING:localstack.services.awslambda.lambda_api: Function not found: arn:aws:lambda:us-east-1:000000000000:function:api-local-bdpipe
localstack    | 2020-04-14T19:00:17:WARNING:localstack.utils.cloudformation.template_deployer: Error calling <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.Lambda object at 0x7fc929806340>> with params: {'FunctionName': 'api-local-bdpipe', 'CodeSha256': 'v7Fnk3nzhFrM3Cu8+79Z9s/bxeV0jJD90uBDvW+/+08='} for resource: {'Type': 'AWS::Lambda::Version', 'DeletionPolicy': 'Retain', 'Properties': {'FunctionName': 'api-local-bdpipe', 'CodeSha256': 'v7Fnk3nzhFrM3Cu8+79Z9s/bxeV0jJD90uBDvW+/+08='}}
localstack    | 2020-04-14T19:00:17:ERROR:localstack.services.cloudformation.cloudformation_starter: Unable to parse and create resource "BdpipeLambdaVersionUqVEqKWOcJPDf9qm4UPGlmcvUxD3pvE95yVtV3biwpg": An error occurred (ResourceNotFoundException) when calling the PublishVersion operation: Function not found: arn:aws:lambda:us-east-1:000000000000:function:api-local-bdpipe Traceback (most recent call last):
localstack    |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 183, in parse_and_create_resource
localstack    |     return _parse_and_create_resource(
localstack    |   File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 292, in _parse_and_create_resource
localstack    |     result = deploy_func(logical_id, resource_map_new, stack_name=stack_name)
localstack    |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 961, in deploy_resource
localstack    |     return execute_resource_action(resource_id, resources, stack_name, ACTION_CREATE)
localstack    |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 987, in execute_resource_action
localstack    |     result = configure_resource_via_sdk(resource_id, resources, resource_type, func, stack_name)
localstack    |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1064, in configure_resource_via_sdk
localstack    |     raise e
localstack    |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1061, in configure_resource_via_sdk
localstack    |     result = function(**params)
localstack    |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
localstack    |     return self._make_api_call(operation_name, kwargs)
localstack    |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 626, in _make_api_call
localstack    |     raise error_class(parsed_response, operation_name)
localstack    | botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the PublishVersion operation: Function not found: arn:aws:lambda:us-east-1:000000000000:function:api-local-bdpipe
localstack    | 
localstack    | 2020-04-14T19:00:17:DEBUG:localstack.services.cloudformation.cloudformation_listener: Error response for CloudFormation action "UpdateStack" (400) POST /: b'Function not found: arn:aws:lambda:us-east-1:000000000000:function:api-local-bdpipe'

Here's my serverless.yml:

service: api

provider:
  name: aws
  runtime: nodejs12.x
  stage: local
  region: us-east-1

plugins:
  - serverless-offline
  - serverless-localstack

functions:
  - '${file(src/handlers/bdpipe/bdpipe.serverless.yml)}'

deploymentBucket:
  name: iotr-functions

custom:
  localstack:
    debug: true
    stages:
      - local
      - dev
    host: http://localstack # optional - LocalStack host to connect to
    endpoints:
      S3: http://localstack:4572
      # DynamoDB: http://localocalstacklhost:4570
      CloudFormation: http://localstack:4581
      IAM: http://localstack:4593
      CloudWatchLogs: http://localstack:4586
      # Elasticsearch: http://localstack:4571
      # ES: http://localstack:4578
      # SNS: http://localstack:4575
      # SQS: http://localstack:4576
      Lambda: http://localstack:4574
      APIGateway: http://localstack:4567
      # Kinesis: http://localstack:4568
    lambda:
      mountCode: True
    docker:
      sudo: false
  serverless-offline:
    host: 0.0.0.0 # for docker container hosting

And my docker-compose:

`version: '3'

services:
  api:
    build: .
    image: local/api
    depends_on:
      - localstack
    ports:
      - '3000:3000'
    container_name: local_api
    volumes:
      - .:/usr/src/app

    # these are the environment variables that are used in the api
    environment:
      AWS_ENDPOINT: 'http://localstack:8000' # localstack container host for dynamodb
      AWS_REGION: 'us-east-1'
      AWS_ACCESS_KEY_ID: 'fake-access-key-id'
      AWS_SECRET_ACCESS_KEY: 'fake-secret-key'
      LOCALSTACK_HOST: 'localstack' # for awslocal cli tool

  localstack:
    image: localstack/localstack:latest
    container_name: localstack
    ports:
      - '8080:8080'
      - '4540-4599:4540-4599'
    environment:
      - SERVICES=s3,lamda,cloudformation,apigateway,serverless
      - DEBUG=1
      - DATA_DIR=/tmp/localstack/data
      - LAMBDA_EXECUTOR=docker
      - DEFAULT_REGION=us-east-1
      - LAMBDA_REMOTE_DOCKER=true
      - LAMBDA_DOCKER_NETWORK=localstack_default
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - './.localstack:/tmp/localstack'
      - '/var/run/docker.sock:/var/run/docker.sock'
`Any pointers on how to better debug this greatly appreciated. Thanks.

┆Issue is synchronized with this Jira Task by Unito

Unable to deploy EKS cluster

The problem

Deploying a basic example of an EKS cluster fails with LocalStack on local.

The code

The stack comes from the AWS CDK EKS example.

import * as eks from "@aws-cdk/aws-eks"
import * as cdk from "@aws-cdk/core"

export class AwsCdkWithTypescriptFoundationsStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props)

    // provisiong a cluster
    const cluster = new eks.Cluster(this, "hello-eks", {
      version: eks.KubernetesVersion.V1_21,
    })

    // apply a kubernetes manifest to the cluster
    cluster.addManifest("mypod", {
      apiVersion: "v1",
      kind: "Pod",
      metadata: { name: "mypod" },
      spec: {
        containers: [
          {
            name: "hello",
            image: "paulbouwer/hello-kubernetes:1.5",
            ports: [{ containerPort: 8080 }],
          },
        ],
      },
    })
  }
}

Steps to recreate

  1. Add the above code to a TypeScript AWS CDK app
  2. Run the following:
$ cdk synth
$ cdk bootstrap
$ cdk deploy
# ... error 

The error (as far as I can tell) from the docker compose logs:

localstack_1  | 2021-08-11T09:30:04:DEBUG:localstack.services.cloudformation.cloudformation_api: Unable to resolve references in stack outputs: {'Value': {'Fn::Join': ['', ['aws eks get-token --cluster-name ', {'Ref': 'HelloEKS39C624A1'}, ' --region ', {'Ref': 'AWS::Region'}, ' --role-arn ', {'Fn::GetAtt': ['HelloEKSMastersRole53742E60', 'Arn']}]]}} - Unable to fetch details for resource "HelloEKS39C624A1" (attribute "Ref")
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.services.cloudformation.cloudformation_api: Executing change set "cdk-deploy-change-set" for stack "AwsCdkWithTypescriptFoundationsStack" with 37 resources ...
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.utils.cloudformation.template_deployer: Error applying changes for CloudFormation stack "AwsCdkWithTypescriptFoundationsStack": An error occurred (DependencyViolation) when calling the DeleteRouteTable operation: The routeTable 'rtb-ea506a4e' has dependencies and cannot be deleted. Traceback (most recent call last):
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1828, in _run
localstack_1  |     self.do_apply_changes_in_loop(changes, stack, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1879, in do_apply_changes_in_loop
localstack_1  |     self.apply_change(change, stack, new_resources, stack_name=stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1934, in apply_change
localstack_1  |     result = delete_resource(resource_id, old_stack.resources, stack_name)
localstack_1  |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 984, in delete_resource
localstack_1  |     ec2_client.delete_route_table(RouteTableId=rt['RouteTableId'])
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 386, in _api_call
localstack_1  |     return self._make_api_call(operation_name, kwargs)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/botocore/client.py", line 705, in _make_api_call
localstack_1  |     raise error_class(parsed_response, operation_name)
localstack_1  | botocore.exceptions.ClientError: An error occurred (DependencyViolation) when calling the DeleteRouteTable operation: The routeTable 'rtb-ea506a4e' has dependencies and cannot be deleted.
localstack_1  | 
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.utils.cloudformation.template_deployer: Extract resource attribute: Custom::AWSCDK-EKS-Cluster Ref
localstack_1  | 2021-08-11T09:30:07:DEBUG:localstack.services.cloudformation.cloudformation_api: Unable to resolve references in stack outputs: {'Value': {'Fn::Join': ['', ['aws eks update-kubeconfig --name ', {'Ref': 'HelloEKS39C624A1'}, ' --region ', {'Ref': 'AWS::Region'}, ' --role-arn ', {'Fn::GetAtt': ['HelloEKSMastersRole53742E60', 'Arn']}]]}} - Unable to fetch details for resource "HelloEKS39C624A1" (attribute "Ref")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.