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

Invalid type for parameter integrationHttpMethod

Open cbm-aboubcher opened this issue 4 years ago • 0 comments
trafficstars

I'm trying to deploy a sample serverless stack using the serverless-localstack plugin but I'm getting this error

localstack_1  | 2021-01-22T22:20:42:INFO:localstack.utils.cloudformation.template_deployer: Unable to create stack uploadToS3-local: 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'>

My serverless file:

service: uploadToS3

frameworkVersion: ">=1.1.0"

custom:
  bucket: tutorial
  localstack:
    stages:
      - local
    host: http://localhost
    endpointFile: localstack_endpoints.json
    lambda:
      mountCode: True
provider:
  name: aws
  runtime: nodejs10.x
  region: us-east-1
  deploymentBucket:
    name: tutorial

functions:
  uploadImageToS3:
    handler: getSample.handler
    events:
      - http:
          path: /get
          method: GET
          cors: true

plugins:
  - serverless-localstack

localstack_endpoints.json:

{
    "APIGateway": "http://localhost:4566",
    "CloudFormation": "http://localhost:4566",
    "CloudWatch":"http://localhost:4566",
    "DynamoDB": "http://localhost:4566",
    "DynamoDBStreams": "http://localhost:4566",
    "ES": "http://localhost:4566",
    "EC2": "http://localhost:4566",
    "IAM": "http://localhost:4566",
    "Firehose": "http://localhost:4566",
    "Kinesis": "http://localhost:4566",
    "Lambda": "http://localhost:4566",
    "Redshift": "http://localhost:4566",
    "Route53": "http://localhost:4566",
    "S3": "http://localhost:4566",
    "SES": "http://localhost:4566",
    "SNS": "http://localhost:4566",
    "SQS": "http://localhost:4566",
    "StepFunctions": "http://localhost:4566",
    "Sts": "http://localhost:4566"
}

docker-compose:

version: '2.1'

services:
  localstack:
    image: localstack/localstack:latest
    ports:
      - "4566-4599:4566-4599"
      - "8080:8080"
    environment:
      - SERVICES=${SERVICES- }
      - DEFAULT_REGION=us-east-1
      - AWS_XRAY_SDK_ENABLED=true
      - DEBUG=${DEBUG- }
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=${PORT_WEB_UI- }
      - LAMBDA_EXECUTOR=docker
      - LAMBDA_REMOTE_DOCKER=false
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

When I deploy my lambda without cors everything works fine, but with cors: true I got the above error

cbm-aboubcher avatar Jan 22 '21 22:01 cbm-aboubcher