本地堆栈说已启动,但引发了不同的错误`错误转发请求:TypeError:JSON对象必须为str,bytes或bytearray

时间:2019-09-22 18:38:04

标签: python-3.x localstack

我开始使用localstack进行基础构建时得到了这个

Starting local dev environment. CTRL-C to quit.
cannot import name 'dns_server' from 'localstack_ext.services' (unknown location)
Starting mock S3 (http port 4572)...
Starting mock SNS (http port 4575)...
2019-09-21T13:11:08:INFO:localstack.multiserver: Starting multi API server process on port 
51492
Starting mock SQS (http port 4576)...
Starting mock DynamoDB (http port 4569)...
Starting mock Lambda service (http port 4574)...
Starting mock CloudWatch Logs (http port 4586)...
Ready.

但是当我执行http://localhost:4569时,它会引发错误,并且不会显示错误已开始。 以下是我遇到的错误

2019-09-21T13:15:05:ERROR:localstack.services.generic_proxy: Error forwarding request: the 
JSON object must be str, bytes or bytearray, not NoneType Traceback (most recent call last):
File "/Users//workspaces/others/localstack/localstack/services/generic_proxy.py", line 240, 
in forward
path=path, data=data, headers=forward_headers)
File"/Users//workspaces/others/localstack/localstack/services/dynamodb/dynamodb_listener.py", 
line 35, in forward_request
data = json.loads(to_str(data))
File"/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/init.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '

TypeError: the JSON object must be str, bytes or bytearray, not NoneType

错误2:

2019-09-21T13:14:11:ERROR:localstack.services.generic_proxy: Error forwarding request:'QueueUrl' Traceback (most recent call last):

File "/Users//workspaces/others/localstack/localstack/services/generic_proxy.py", line 240, in forward
path=path, data=data, headers=forward_headers)
File "/Users//workspaces/others/localstack/localstack/services/sqs/sqs_listener.py", line 53, in forward_request
self._set_queue_attributes(req_data)
File "/Users/*****/workspaces/others/localstack/localstack/services/sqs/sqs_listener.py", line 245, in _set_queue_attributes
queue_url = req_data['QueueUrl'][0]
KeyError: 'QueueUrl'`

请帮助它,这对我来说是一个障碍。

1 个答案:

答案 0 :(得分:1)

这是因为我打的不是用户界面的http://localhost:4569。因此,它会引发错误。但是,如果我使用aws cli创建表并执行一些操作,它将正常工作而不会出现任何问题。