Я пытаюсь опубликовать iot msg из другой учетной записи AWS.
Мои текущие ситуации:
В соответствии с требованиями у меня есть 2 разные учетные записи AWS => (1) для работника, (2) для iOT
- Я получаю IAMучетные данные пользователя (ключ доступа, секретный ключ) из (2)
- Я создаю рабочую среду Python для использования сообщения SQS в (1) => рабочий будет обрабатывать сообщение SQS и публиковать сообщение IoT.
мой код для работника: application.py (с использованием boto3, python):
import boto3
import flask
from flask import request, Response
iot_client = boto3.client(
'iot-data',
aws_access_key_id='XXXXXXXX',
aws_secret_access_key='xxxxxxxxxx',
region_name='eu-west-1'
)
application = flask.Flask(__name__)
application.config.from_object('default_config')
application.debug = application.config['FLASK_DEBUG'] in ['true', 'True']
@application.route('/myworker', methods=['POST'])
def myworker():
iot_client.publish(
topic='mytopic',
qos=0,
payload= request
)
response = Response("", status=200)
Я загружаю, развертываю на работника и отправляю сообщение в SQS, рабочий начинает опрашивать сообщение SQS, но я получил ошибку
для элемента в итерируемом:
TypeError: 'ParamValidationError' объект не повторяется
Исключительная ситуация при обработке сценария WSGI '/ opt / python/current/app/application.py'.
Похоже, что я неправильно инициализировал клиента или что-то еще вызвало ошибку.
Любое предложение приветствуется.
******* ОБНОВЛЕНИЕ **********
Я извлекаю журнал ошибок, как показано ниже
[Thu Dec 27 16:06:27.425505 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:06:27.425517 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:32.509920 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:32.510017 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:06:32.510048 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:32.510052 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:06:32.510058 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:32.510061 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:06:32.510077 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:37.585597 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:37.585693 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:06:37.585717 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:37.585721 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:06:37.585726 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:37.585729 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:06:37.585742 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:42.682277 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:42.682377 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:06:42.682400 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:42.682404 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:06:42.682410 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:42.682413 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:06:42.682430 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:47.750299 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:47.750394 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:06:47.750417 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:47.750421 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:06:47.750427 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:47.750430 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:06:47.750443 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:52.948113 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:52.948206 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:06:52.948238 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:52.948243 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:06:52.948249 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:52.948252 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:06:52.948268 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:06:58.001714 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:06:58.001827 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:06:58.001849 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:06:58.001853 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:06:58.001859 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:06:58.001862 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:06:58.001874 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:03.047906 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:03.048017 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:03.048040 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:03.048043 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:03.048049 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:03.048052 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:03.048065 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:08.109607 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:08.109702 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:08.109723 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:08.109727 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:08.109733 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:08.109736 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:08.109748 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:13.161710 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:13.161809 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:07:13.161840 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:13.161856 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:07:13.161863 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:13.161866 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:07:13.161879 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:18.206671 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:18.206766 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:07:18.206788 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:18.206793 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:07:18.206798 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:18.206801 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:07:18.206814 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:23.270210 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:23.270305 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:23.270369 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:23.270374 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:23.270392 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:23.270395 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:23.270408 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:28.318729 2018] [:error] [pid 3383] [remote 127.0.0.1:16] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:28.318825 2018] [:error] [pid 3383] [remote 127.0.0.1:16] Traceback (most recent call last):
[Thu Dec 27 16:07:28.318848 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:28.318852 2018] [:error] [pid 3383] [remote 127.0.0.1:16] return self._next()
[Thu Dec 27 16:07:28.318858 2018] [:error] [pid 3383] [remote 127.0.0.1:16] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:28.318861 2018] [:error] [pid 3383] [remote 127.0.0.1:16] for item in iterable:
[Thu Dec 27 16:07:28.318873 2018] [:error] [pid 3383] [remote 127.0.0.1:16] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:33.368395 2018] [:error] [pid 3383] [remote 127.0.0.1:12] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:33.368498 2018] [:error] [pid 3383] [remote 127.0.0.1:12] Traceback (most recent call last):
[Thu Dec 27 16:07:33.368520 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:33.368524 2018] [:error] [pid 3383] [remote 127.0.0.1:12] return self._next()
[Thu Dec 27 16:07:33.368538 2018] [:error] [pid 3383] [remote 127.0.0.1:12] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:33.368541 2018] [:error] [pid 3383] [remote 127.0.0.1:12] for item in iterable:
[Thu Dec 27 16:07:33.368554 2018] [:error] [pid 3383] [remote 127.0.0.1:12] TypeError: 'ParamValidationError' object is not iterable
[Thu Dec 27 16:07:38.476527 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] mod_wsgi (pid=3383): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.
[Thu Dec 27 16:07:38.476616 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] Traceback (most recent call last):
[Thu Dec 27 16:07:38.476637 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wsgi.py", line 682, in __next__
[Thu Dec 27 16:07:38.476641 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] return self._next()
[Thu Dec 27 16:07:38.476646 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] File "/opt/python/run/venv/local/lib/python3.6/site-packages/werkzeug/wrappers.py", line 81, in _iter_encoded
[Thu Dec 27 16:07:38.476649 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] for item in iterable:
[Thu Dec 27 16:07:38.476661 2018] [:error] [pid 3383] [remote 127.0.0.1:17936] TypeError: 'ParamValidationError' object is not iterable