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

Unable to trigger lambda from kinesis on local env

Open BlinkFrozen opened this issue 5 years ago • 0 comments
trafficstars

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

BlinkFrozen avatar Oct 28 '20 13:10 BlinkFrozen