localstack / localstack

💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
https://localstack.cloud
Other
56.44k stars 4.02k forks source link

Kinesis not running inside docker #1597

Closed JavaTec closed 4 years ago

JavaTec commented 5 years ago

We're running Docker on Windows 10. We have a simple java springboot application, which should interact with aws kinesis and s3. For local testing, we want to pull the localstack docker latest image and install and run. But the startup for Kinesis throws error whereas S3 works fine. Below are the details:

docker compose:
version: '3.1'
services:
  localstack:
    image: "localstack/localstack"
    container_name: localstack_demo
    environment:
      SERVICES: kinesis, s3, sqs
      DEBUG: 1
      DATA_DIR: /tmp/localstack
      KINESIS_STREAM_SHARDS: 1
      KINESIS_ERROR_PROBABILITY: 0.0
      KINESIS_STREAM_NAME: my-stream
    ports:
      - "4567-4584:4567-4584"
      - "8055:8080"
    volumes:
      - './.localstack:/tmp/localstack'
      - '/var/run/docker.sock:/var/run/docker.sock'

When we try to hit the default url fot Kinesis, http://localhost:4568, we get the following error: (please note that default url for S3 responds as expected):

localstack_demo | 2019-09-24T22:35:27:ERROR:localstack.services.generic_proxy: Error forwarding request: the JSON object must be str, bytes or bytearray, not 'NoneType' Traceback (most recent call last):
localstack_demo |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 240, in forward
localstack_demo |     path=path, data=data, headers=forward_headers)
localstack_demo |   File "/opt/code/localstack/localstack/services/kinesis/kinesis_listener.py", line 22, in forward_request
localstack_demo |     data = json.loads(to_str(data))
localstack_demo |   File "/usr/lib/python3.6/json/__init__.py", line 348, in loads
localstack_demo |     'not {!r}'.format(s.__class__.__name__))
localstack_demo | TypeError: the JSON object must be str, bytes or bytearray, not 'NoneType'
Mukundhan-I2I commented 4 years ago

Same here +1

whummer commented 4 years ago

Thanks for reporting @JavaTec @MukundhanSampath .

When we try to hit the default url fot Kinesis, http://localhost:4568, we get the following error:

Note that this error does not necessarily mean that Kinesis is not running. It looks like you're trying to run an HTTP request with empty request body, which is not a valid Kinesis API request. It should indeed work if you use the "awslocal kinesis ..." command line, or a proper Kinesis AWS SDK. In any case - the handling of empty request bodies has been fixed in #1817 to avoid confusion. Thanks