Google Assistant sdk GRPC authentication error : io.grpc.StatusRuntimeException: UNAUTHENTICATED: - grpc

I successfully created EmbeddedAssistantStub using the below code.
EmbeddedAssistantGrpc.EmbeddedAssistantStub mAssistantService = EmbeddedAssistantGrpc.newStub(channel)
.withCallCredentials(MoreCallCredentials.from(
Credentials.fromResource(mClientId,mRefreshToken,mAccessToken)
));
After this i passed audio data to StreamObserver, At that time below exxception was occured.
Line 3378: 12-07 12:59:25.099 1917 4286 E GASample: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
Line 3378: 12-07 12:59:25.099 1917 4286 E GASample: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
Line 3379: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.Status.asRuntimeException(Status.java:540)
Line 3380: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:392)
Line 3381: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:428)
Line 3382: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
Line 3383: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:514)
Line 3384: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:431)
Line 3385: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:546)
Line 3386: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
Line 3387: 12-07 12:59:25.099 1917 4286 E GASample: at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:152)
Line 3388: 12-07 12:59:25.099 1917 4286 E GASample: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
Line 3389: 12-07 12:59:25.099 1917 4286 E GASample: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
Line 3390: 12-07 12:59:25.099 1917 4286 E GASample: at java.lang.Thread.run(Thread.java:764)
After this no response from response observer.
Kindly help me to solve this issue.

They messed up with their backend. Just wait until they fix it. Here is the github thread regarding that bug:
https://github.com/googlesamples/assistant-sdk-python/issues/138

They fixed this issue at back-end.
#JHorseman : Thanks for the support.

Related

Openstack Watcher complains about endpoint not found even though it is defined in the catalog

I have the following scenario:
server: Ubuntu 20.04.3 LTS
Openstack: installed following the official guide
Watcher: 1:4.0.0-0ubuntu0.20.04.1 (installed also following the official wiki)
Everything works like a charm, however, when I run
root#controller:/etc/watcher# openstack optimize service list
Internal Server Error (HTTP 500)
root#controller:/etc/watcher#
and checked what is it about on watcher's log
2022-01-15 17:25:58.509 17960 INFO watcher-api [-] 10.0.0.11 "GET /v1/services HTTP/1.1" status: 500 len: 139 time: 0.0277412
2022-01-15 17:40:52.535 17960 INFO watcher-api [-] Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/eventlet/wsgi.py", line 573, in handle_one_response
result = self.application(self.environ, start_response)
File "/usr/lib/python3/dist-packages/watcher/api/app.py", line 58, in __call__
return self.v1(environ, start_response)
File "/usr/lib/python3/dist-packages/watcher/api/middleware/auth_token.py", line 61, in __call__
return super(AuthTokenMiddleware, self).__call__(env, start_response)
File "/usr/local/lib/python3.8/dist-packages/webob/dec.py", line 129, in __call__
resp = self.call_func(req, *args, **kw)
File "/usr/local/lib/python3.8/dist-packages/webob/dec.py", line 193, in call_func
return self.func(req, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/__init__.py", line 338, in __call__
response = self.process_request(req)
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/__init__.py", line 659, in process_request
resp = super(AuthProtocol, self).process_request(request)
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/__init__.py", line 409, in process_request
data, user_auth_ref = self._do_fetch_token(
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/__init__.py", line 445, in _do_fetch_token
data = self.fetch_token(token, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/__init__.py", line 752, in fetch_token
data = self._identity_server.verify_token(
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/_identity.py", line 157, in verify_token
auth_ref = self._request_strategy.verify_token(
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/_identity.py", line 108, in _request_strategy
strategy_class = self._get_strategy_class()
File "/usr/local/lib/python3.8/dist-packages/keystonemiddleware/auth_token/_identity.py", line 130, in _get_strategy_class
if self._adapter.get_endpoint(version=klass.AUTH_VERSION):
File "/usr/local/lib/python3.8/dist-packages/keystoneauth1/adapter.py", line 291, in get_endpoint
return self.session.get_endpoint(auth or self.auth, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/keystoneauth1/session.py", line 1233, in get_endpoint
return auth.get_endpoint(self, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/keystoneauth1/identity/base.py", line 375, in get_endpoint
endpoint_data = self.get_endpoint_data(
File "/usr/local/lib/python3.8/dist-packages/keystoneauth1/identity/base.py", line 275, in get_endpoint_data
endpoint_data = service_catalog.endpoint_data_for(
File "/usr/local/lib/python3.8/dist-packages/keystoneauth1/access/service_catalog.py", line 462, in endpoint_data_for
raise exceptions.EndpointNotFound(msg)
keystoneauth1.exceptions.catalog.EndpointNotFound: internal endpoint for identity service in regionOne region not found
and the request on the webserver side
==> horizon_access.log <==
127.0.0.1 - - [15/Jan/2022:17:38:29 +0300] "GET /dashboard/project/api_access/view_credentials/ HTTP/1.1" 200 1027 "http://localhost/dashboard/project/api_access/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
10.0.0.11 - - [15/Jan/2022:17:38:30 +0300] "GET /identity/v3/auth/tokens HTTP/1.1" 200 5318 "-" "python-keystoneclient"
10.0.0.11 - - [15/Jan/2022:17:38:30 +0300] "GET /compute/v2.1/servers/detail?all_tenants=True&changes-since=2022-01-15T14%3A33%3A30.416004%2B00%3A00 HTTP/1.1" 200 433 "-" "python-novaclient"
10.0.0.11 - - [15/Jan/2022:17:40:52 +0300] "GET /identity HTTP/1.1" 300 569 "-" "openstacksdk/0.50.0 keystoneauth1/4.2.1 python-requests/2.23.0 CPython/3.8.10"
10.0.0.11 - - [15/Jan/2022:17:40:52 +0300] "POST /identity/v3/auth/tokens HTTP/1.1" 201 5316 "-" "openstacksdk/0.50.0 keystoneauth1/4.2.1 python-requests/2.23.0 CPython/3.8.10"
10.0.0.11 - - [15/Jan/2022:17:40:52 +0300] "POST /identity/v3/auth/tokens HTTP/1.1" 201 5320 "-" "watcher/unknown keystonemiddleware.auth_token/9.1.0 keystoneauth1/4.2.1 python-requests/2.23.0 CPython/3.8.10"
and on keystone side - I run it with some verbosity using the following command
/usr/bin/uwsgi --procname-prefix keystone --ini /etc/keystone/keystone-uwsgi-public.ini
I got the following log
DEBUG keystone.server.flask.request_processing.req_logging [None req-e422207d-b376-4e97-b20b-1d16144be4db None None] REQUEST_METHOD: `GET` {{(pid=20441) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:27}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-e422207d-b376-4e97-b20b-1d16144be4db None None] SCRIPT_NAME: `/identity` {{(pid=20441) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:28}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-e422207d-b376-4e97-b20b-1d16144be4db None None] PATH_INFO: `/` {{(pid=20441) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:29}}
[pid: 20441|app: 0|req: 1/1] 10.0.0.11 () {58 vars in 998 bytes} [Sat Jan 15 17:44:30 2022] GET /identity => generated 268 bytes in 5 msecs (HTTP/1.1 300) 6 headers in 232 bytes (1 switches on core 0)
DEBUG keystone.server.flask.request_processing.req_logging [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] REQUEST_METHOD: `POST` {{(pid=20440) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:27}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] SCRIPT_NAME: `/identity` {{(pid=20440) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:28}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] PATH_INFO: `/v3/auth/tokens` {{(pid=20440) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:29}}
DEBUG oslo_db.sqlalchemy.engines [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] MySQL server mode set to STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_ENGINE_SUBSTITUTION {{(pid=20440) _check_effective_sql_mode /usr/local/lib/python3.8/dist-packages/oslo_db/sqlalchemy/engines.py:304}}
DEBUG passlib.handlers.bcrypt [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] detected 'bcrypt' backend, version '3.2.0' {{(pid=20440) _load_backend_mixin /usr/local/lib/python3.8/dist-packages/passlib/handlers/bcrypt.py:567}}
DEBUG passlib.handlers.bcrypt [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] 'bcrypt' backend lacks $2$ support, enabling workaround {{(pid=20440) _finalize_backend_mixin /usr/local/lib/python3.8/dist-packages/passlib/handlers/bcrypt.py:382}}
DEBUG keystone.auth.core [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] MFA Rules not processed for user `97eec1465cdc4e41b5c0ba48a1b39cc2`. Rule list: `[]` (Enabled: `True`). {{(pid=20440) check_auth_methods_against_rules /opt/stack/keystone/keystone/auth/core.py:438}}
DEBUG keystone.common.fernet_utils [None req-cc547fb9-886e-4ed2-a3be-7e043004eed8 None None] Loaded 2 Fernet keys from /etc/keystone/fernet-keys/, but `[fernet_tokens] max_active_keys = 3`; perhaps there have not been enough key rotations to reach `max_active_keys` yet? {{(pid=20440) load_keys /opt/stack/keystone/keystone/common/fernet_utils.py:286}}
[pid: 20440|app: 0|req: 1/2] 10.0.0.11 () {62 vars in 1095 bytes} [Sat Jan 15 17:44:30 2022] POST /identity/v3/auth/tokens => generated 4862 bytes in 125 msecs (HTTP/1.1 201) 6 headers in 385 bytes (1 switches on core 0)
DEBUG keystone.server.flask.request_processing.req_logging [None req-0584fbcc-66c5-4fba-9d8a-ea8ad2d40c5d None None] REQUEST_METHOD: `GET` {{(pid=20441) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:27}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-0584fbcc-66c5-4fba-9d8a-ea8ad2d40c5d None None] SCRIPT_NAME: `/identity` {{(pid=20441) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:28}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-0584fbcc-66c5-4fba-9d8a-ea8ad2d40c5d None None] PATH_INFO: `/` {{(pid=20441) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:29}}
[pid: 20441|app: 0|req: 2/3] 10.0.0.11 () {58 vars in 1033 bytes} [Sat Jan 15 17:44:30 2022] GET /identity => generated 268 bytes in 2 msecs (HTTP/1.1 300) 6 headers in 232 bytes (1 switches on core 0)
DEBUG keystone.server.flask.request_processing.req_logging [None req-f096d017-66d0-4baa-8414-2596d0869005 None None] REQUEST_METHOD: `POST` {{(pid=20440) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:27}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-f096d017-66d0-4baa-8414-2596d0869005 None None] SCRIPT_NAME: `/identity` {{(pid=20440) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:28}}
DEBUG keystone.server.flask.request_processing.req_logging [None req-f096d017-66d0-4baa-8414-2596d0869005 None None] PATH_INFO: `/v3/auth/tokens` {{(pid=20440) log_request_info /opt/stack/keystone/keystone/server/flask/request_processing/req_logging.py:29}}
DEBUG keystone.auth.core [None req-f096d017-66d0-4baa-8414-2596d0869005 None None] MFA Rules not processed for user `c5c42a1a942e48fd9b735ea9c6a11ed0`. Rule list: `[]` (Enabled: `True`). {{(pid=20440) check_auth_methods_against_rules /opt/stack/keystone/keystone/auth/core.py:438}}
DEBUG keystone.common.fernet_utils [None req-f096d017-66d0-4baa-8414-2596d0869005 None None] Loaded 2 Fernet keys from /etc/keystone/fernet-keys/, but `[fernet_tokens] max_active_keys = 3`; perhaps there have not been enough key rotations to reach `max_active_keys` yet? {{(pid=20440) load_keys /opt/stack/keystone/keystone/common/fernet_utils.py:286}}
[pid: 20440|app: 0|req: 2/4] 10.0.0.11 () {62 vars in 1130 bytes} [Sat Jan 15 17:44:30 2022] POST /identity/v3/auth/tokens => generated 4866 bytes in 26 msecs (HTTP/1.1 201) 6 headers in 385 bytes (2 switches on core 0)
So the first thing I did is to check the catalog
openstack catalog list
----
| keystone | identity | RegionOne |
| | | internal: http://controller/identity |
| | | RegionOne |
| | | public: http://controller/identity |
| | | RegionOne |
| | | admin: http://controller/identity |
| | | |
---
My question is: do I need to create a specific (another) internal endpoint for the identity service and where should I declare it for the watcher-api to find it?
EDIT: Following #Larsks comment, I changed the credentials used on watcher.conf by username=admin (the admin user) and the corresponding password. Openstack optimize service list gave back the following
WARNING keystonemiddleware.auth_token [-] Identity response: {"error":{"code":401,"message":"The request you have made requires authentication.","title":"Unauthorized"}}
: keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication. (HTTP 401) (Request-ID: req-56b63a60-1ba2-4f12-93c0-e7c7d1a1769c)
2022-01-15 19:04:17.424 28742 CRITICAL keystonemiddleware.auth_token [-] Unable to validate token: Identity server rejected authorization necessary to fetch token data: keystonemiddleware.auth_token._exceptions.ServiceError: Identity server rejected authorization necessary to fetch token data

10054 & SSL errors from non-Indy client to Indy Server (kbmMWTCPIPIndyServerTransport)

We have a kbmMW server that uses an Indy TCPIP Server Transport behind the scenes. We have a server that is currently in testing with a mobile client that is under development.
Overall everything is working pretty well, but we occasionally get 10054's EIdSocketExceptions and EIdSSLExceptions. This appears to be just normal TCPIP 'cost of doing business'. Unfortunately it is occurring in non-VCL main threads and it is crashing the server.
Our goal is to simply know where, when and how to gracefully handle these errors so that it doesn't crash the server.
I've included madExcept logs below:
thread $19c0 (TIdThreadWithTask), inner exception level 1:
EIdSocketError, Socket Error # 10054
Connection reset by peer.
0146005b +073 icms.exe IdStack 929 +54 TIdStack.RaiseSocketError
0145ffe2 +016 icms.exe IdStack 852 +1 TIdStack.RaiseLastSocketError
0145ff4d +015 icms.exe IdStack 826 +2 TIdStack.CheckForSocketError
014587c5 +02d icms.exe IdStackBSDBase 440 +1 TIdStackBSDBase.Receive
014960b1 +011 icms.exe IdSocketHandle 319 +1 TIdSocketHandle.Receive
0149a0ee +006 icms.exe IdIOHandlerStack 378 +0 TIdIOHandlerStack.ReadDataFromSource
014a5f8d +009 icms.exe IdSSL 180 +1 TIdSSLIOHandlerSocketBase.ReadDataFromSource
01493005 +0e5 icms.exe IdIOHandler 1688 +28 TIdIOHandler.ReadFromSource
01499ccb +00b icms.exe IdIOHandlerStack 232 +1 TIdIOHandlerStack.Connected
0149ec43 +013 icms.exe IdTCPConnection 503 +3 TIdTCPConnection.Connected
0198dc4f +117 icms.exe kbmMWTCPIPIndyServerTransport 353 +18 TkbmMWCustomTCPIPIndyServerTransport.OnExecute
014a46ec +018 icms.exe IdCustomTCPServer 553 +2 TIdCustomTCPServer.DoExecute
014a0f63 +00f icms.exe IdContext 185 +2 TIdContext.Run
0149fafe +002 icms.exe IdTask 136 +0 TIdTask.DoRun
014a21e6 +006 icms.exe IdThread 697 +1 TIdThreadWithTask.Run
014a1ba1 +0f5 icms.exe IdThread 428 +50 TIdThread.Execute
00545489 +049 icms.exe System.Classes 14701 +18 ThreadProc
0040cbf4 +028 icms.exe System 23825 +45 ThreadWrapper
004b327d +00d icms.exe madExcept CallThreadProcSafe
004b32e2 +032 icms.exe madExcept ThreadExceptFrame
77587c02 +022 KERNEL32.DLL BaseThreadInitThunk
014a1da2 +052 icms.exe IdThread 522 +24 TIdThread.Create
Also:
Details: Error accepting connection with SSL.
error:1408A0C1:SSL routines:ssl3_get_client_hello:no shared cipher
Details: Error accepting connection with SSL.
error:1408A10B:SSL routines:ssl3_get_client_hello:wrong version number
Details: Error accepting connection with SSL.
EOF was observed that violates the protocol
Details: Error accepting connection with SSL.
error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
Thanks!

Hunchentoot is unknown handler

The binary of my web-app built on CI fails to run, and succeeds if built locally. What could cause those differences, what would cause Hunchentoot to fail with this message ?
Here are the different stacktraces:
<INFO> [14:42:11] weblocks/server server.lisp (start) -
Starting weblocks WEBLOCKS/SERVER::PORT: 4000
WEBLOCKS/SERVER::SERVER-TYPE: :HUNCHENTOOT DEBUG: T
<INFO> [14:42:11] weblocks/server server.lisp (start-server) -
Starting webserver on WEBLOCKS/SERVER::INTERFACE: "localhost"
WEBLOCKS/SERVER::PORT: 4000 DEBUG: T
Unhandled SIMPLE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
{10005C85B3}>:
:HUNCHENTOOT is unknown handler.
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10005C85B3}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SIMPLE-ERROR "~S is unknown handler." {100495FEC3}> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<SIMPLE-ERROR "~S is unknown handler." {100495FEC3}>)
2: (INVOKE-DEBUGGER #<SIMPLE-ERROR "~S is unknown handler." {100495FEC3}>)
3: (UIOP/IMAGE:HANDLE-FATAL-CONDITION #<SIMPLE-ERROR "~S is unknown handler." {100495FEC3}>)
4: (SB-KERNEL::%SIGNAL #<SIMPLE-ERROR "~S is unknown handler." {100495FEC3}>)
5: (ERROR "~S is unknown handler." :HUNCHENTOOT)
6: (CLACK.UTIL:FIND-HANDLER :HUNCHENTOOT)
7: (CLACK:CLACKUP #<CLOSURE (LAMBDA (LACK.MIDDLEWARE.SESSION::ENV) :IN "/home/lisp/quicklisp/dists/quicklisp/software/lack-20181018-git/src/middleware/session.lisp") {100467727B}> :ADDRESS "localhost" :SERVER :HUNCHENTOOT :PORT 4000 :DEBUG T)
8: (WEBLOCKS/SERVER::START-SERVER #<SERVER port=4000 stopped> :DEBUG T)
9: ((LAMBDA (#:G0 &REST #:G1) :IN WEBLOCKS/SERVER:START) NIL)
10: (WEBLOCKS/SERVER:START :DEBUG T :PORT 4000 :INTERFACE "localhost" :SERVER-TYPE :HUNCHENTOOT)
11: (TORRENTS:MAIN)
12: ((LAMBDA NIL :IN UIOP/IMAGE:RESTORE-IMAGE))
13: (UIOP/IMAGE:CALL-WITH-FATAL-CONDITION-HANDLER #<CLOSURE (LAMBDA NIL :IN UIOP/IMAGE:RESTORE-IMAGE) {1004410D9B}>)
14: ((FLET SB-UNIX::BODY :IN SAVE-LISP-AND-DIE))
15: ((FLET "WITHOUT-INTERRUPTS-BODY-34" :IN SAVE-LISP-AND-DIE))
16: ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE))
unhandled condition in --disable-debugger mode, quitting
and locally:
<INFO> [17:11:49] weblocks/server server.lisp (start) -
Starting weblocks WEBLOCKS/SERVER::PORT: 4001
WEBLOCKS/SERVER::SERVER-TYPE: :HUNCHENTOOT DEBUG: T
<INFO> [17:11:49] weblocks/server server.lisp (start-server) -
Starting webserver on WEBLOCKS/SERVER::INTERFACE: "localhost"
WEBLOCKS/SERVER::PORT: 4001 DEBUG: T
_
and it keeps listening.
They run with the same framework version (latest), they seem to run the same Quicklisp dist version (see lack-20181018 on the first stacktrace), which is my local version. The CI is built on daewok/lisp-devel-docker.
I use this starting point:
(defun start ()
(weblocks/debug:on)
(weblocks/server:start :port *port*))
(defun stop ()
(weblocks/server:stop))
(defun main ()
(defvar *port* (find-port:find-port))
(start)
(handler-case (bt:join-thread (find-if (lambda (th)
(search "hunchentoot" (bt:thread-name th)))
(bt:all-threads)))
(#+sbcl sb-sys:interactive-interrupt
#+ccl ccl:interrupt-signal-condition
#+clisp system::simple-interrupt-condition
#+ecl ext:interactive-interrupt
#+allegro excl:interrupt-signal
() (progn
(format *error-output* "Aborting.~&")
;; (weblocks:stop)
(uiop:quit 1))
;; for others, unhandled errors (we might want to do the same).
(error (c) (format t "Woops, an unknown error occured:~&~a~&" c)))))
Thanks again.
Adding the dependency
:clack-handler-hunchentoot
in my .asd did it. Thanks jkiiski.

"Unauthorized: The request you have made requires authentication. (HTTP 401)" on Fiware Horizon

I am new to FIWARE. On my Ubuntu 16.04, I have setup Fiware's KeyRock which is a combination of OpenStack Keystone Identity Management and Horizon Dashboard. I have used this guide to set up everything.
After installing Keystone (which is a RESTful API), I have used curl to send HTTP requests and everything is working fine, i.e. I can run these commands on the keystone server using curl.
However, when I run Horizon on the same server using the reference Django project located in the openstack_dashboard directory with:
sudo tools/with_venv.sh python manage.py runserver 0.0.0.0:8000,
Horizon server starts with no errors but when I access it via browser, I get the following error:
A server error occured. Please contact the administrator
On the Keystone server console, I get the following error:
2017-01-09 11:53:40.962 13285 ERROR keystone.notifications [-] Failed to construct notifier
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications Traceback (most recent call last):
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications File "/keystone/keystone/notifications.py", line 220, in _get_notifier
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications transport = messaging.get_transport(CONF)
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications File "/keystone/.venv/local/lib/python2.7/site-packages/oslo/messaging/transport.py", line 185, in get_transport
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications invoke_kwds=kwargs)
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications File "/keystone/.venv/local/lib/python2.7/site-packages/stevedore/driver.py", line 45, in __init__
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications verify_requirements=verify_requirements,
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications File "/keystone/.venv/local/lib/python2.7/site-packages/stevedore/named.py", line 55, in __init__
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications verify_requirements)
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications File "/keystone/.venv/local/lib/python2.7/site-packages/stevedore/extension.py", line 170, in _load_plugins
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications self._on_load_failure_callback(self, ep, err)
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications File "/keystone/.venv/local/lib/python2.7/site-packages/stevedore/driver.py", line 50, in _default_on_load_failure
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications raise err
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications ImportError: cannot import name _uuid_generate_random
2017-01-09 11:53:40.962 13285 TRACE keystone.notifications
2017-01-09 11:53:40.964 13285 WARNING keystone.common.wsgi [-] Authorization failed. The request you have made requires authentication. from 127.0.0.1
2017-01-09 11:53:40.970 13285 INFO eventlet.wsgi.server [-] 127.0.0.1 - - [09/Jan/2017 11:53:40] "POST /v3/auth/tokens HTTP/1.1" 401 331 0.261293
On the Horizon server console, I get the following error:
DEBUG:idm_logger:Creating a new internal keystoneclient connection to http://0.0.0.0:5000/v3.
Unauthorized: The request you have made requires authentication. (HTTP 401)
Traceback (most recent call last):
File "/horizon/openstack_dashboard/fiware_api/keystone.py", line 990, in _get_element_and_cache
resource_element = function(request, element)
File "/horizon/openstack_dashboard/fiware_api/keystone.py", line 1022, in <lambda>
request, basic, lambda req, n: internal_keystoneclient(req).roles.find(name=n), pickle_props=['name'])
File "/horizon/openstack_dashboard/fiware_api/keystone.py", line 64, in internal_keystoneclient
cache.set(CACHE_CLIENT, keystoneclient.session.get_token(), INTERNAL_CLIENT_CACHE_TIME)
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/session.py", line 610, in get_token
return (self.get_auth_headers(auth) or {}).get('X-Auth-Token')
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/session.py", line 589, in get_auth_headers
return auth.get_headers(self, **kwargs)
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/auth/base.py", line 114, in get_headers
token = self.get_token(session)
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/auth/identity/base.py", line 104, in get_token
return self.get_access(session).auth_token
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/auth/identity/base.py", line 144, in get_access
self.auth_ref = self.get_auth_ref(session)
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/auth/identity/v3.py", line 127, in get_auth_ref
authenticated=False, log=False, **rkwargs)
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/session.py", line 488, in post
return self.request(url, 'POST', **kwargs)
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/utils.py", line 318, in inner
return func(*args, **kwargs)
File "/horizon/.venv/src/python-keystoneclient/keystoneclient/session.py", line 389, in request
raise exceptions.from_response(resp, method, url)
Unauthorized: The request you have made requires authentication. (HTTP 401)
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/horizon/.venv/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 64, in __call__
return self.application(environ, start_response)
File "/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 168, in __call__
self.load_middleware()
File "/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 46, in load_middleware
mw_instance = mw_class()
File "/horizon/.venv/local/lib/python2.7/site-packages/django/middleware/locale.py", line 23, in __init__
for url_pattern in get_resolver(None).url_patterns:
File "/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 367, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/horizon/.venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 361, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/horizon/openstack_dashboard/urls.py", line 36, in <module>
from openstack_dashboard.dashboards.idm_admin.user_accounts \
File "/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/views.py", line 28, in <module>
from openstack_dashboard.dashboards.idm_admin.user_accounts \
File "/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/forms.py", line 195, in <module>
class UpdateAccountForm(forms.SelfHandlingForm, UserAccountsLogicMixin):
File "/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/forms.py", line 202, in UpdateAccountForm
choices=get_account_choices())
File "/horizon/openstack_dashboard/dashboards/idm_admin/user_accounts/forms.py", line 172, in get_account_choices
use_idm_account=True),
File "/horizon/openstack_dashboard/fiware_api/keystone.py", line 1022, in get_basic_role
request, basic, lambda req, n: internal_keystoneclient(req).roles.find(name=n), pickle_props=['name'])
File "/horizon/openstack_dashboard/fiware_api/keystone.py", line 997, in _get_element_and_cache
exceptions.handle(request)
File "/horizon/horizon/exceptions.py", line 291, in handle
messages.error(request, message or fallback)
File "/horizon/horizon/messages.py", line 83, in error
fail_silently=fail_silently)
File "/horizon/horizon/messages.py", line 41, in add_message
if not horizon_message_already_queued(request, message):
File "/horizon/horizon/messages.py", line 28, in horizon_message_already_queued
if request.is_ajax():
AttributeError: 'NoneType' object has no attribute 'is_ajax'
[09/Jan/2017 12:39:35] "GET / HTTP/1.1" 500 59
I am sending a GET request via the browser but the Keystone server is receiving a POST request as indicated in its console output. I don't understand why is this so.
It looks like the Horizon server is not able to verify the credentials.
In the case of Fiware, you would get this error on Horizon server if the file local_settings.py (located in the /horizon/openstack_dashboard/local/ directory) is not properly configured. In this file, there is a dictionary named IDM_USER_CREDENTIALS where you have to set the password for the admin profile that was created when you populated the database of Keystone. It is also given in the link that you provided. Try changing the password and see if it works.

Meteor.http.post sets lowercase 'host' header. How do I override this?

I need to talk to a finicky web server that crashes when I execute this code:
payload = JSON.stringify({
jsonrpc: '2.0',
method: 'sendMessage',
id: 1,
params: {
accountID: 0,
messageText: message,
countDownTime: 0,
interval: 0
}
});
result = Meteor.http.post(api_endpoint, { content: payload });
After some debugging I've narrowed it down to the host header. A tcpdump of my request shows that meteor is sending it in lowercase:
0x0000: 4500 00dd f959 4000 4006 162b 0a01 0b58 E....Y#.#..+...X
0x0010: 0a01 0b3d d6a5 1388 ae92 8657 3d7b 996e ...=.......W={.n
0x0020: 8018 01c9 2b66 0000 0101 080a 183e 7f02 ....+f.......>..
0x0030: 34da 9ad8 504f 5354 202f 2048 5454 502f 4...POST./.HTTP/
0x0040: 312e 310d 0a43 6f6e 7465 6e74 2d54 7970 1.1..Content-Typ
0x0050: 653a 2061 7070 6c69 6361 7469 6f6e 2f78 e:.application/x
0x0060: 2d77 7777 2d66 6f72 6d2d 7572 6c65 6e63 -www-form-urlenc
0x0070: 6f64 6564 0d0a 5573 6572 2d41 6765 6e74 oded..User-Agent
0x0080: 3a20 4d65 7465 6f72 0d0a 4163 6365 7074 :.Meteor..Accept
0x0090: 3a20 2a2f 2a0d 0a68 6f73 743a 2031 302e :.*/*..host:.10.
0x00a0: 312e 3131 2e36 313a 3530 3030 0d0a 636f 1.11.61:5000..co
0x00b0: 6e74 656e 742d 6c65 6e67 7468 3a20 3135 ntent-length:.15
0x00c0: 310d 0a43 6f6e 6e65 6374 696f 6e3a 206b 1..Connection:.k
0x00d0: 6565 702d 616c 6976 650d 0a0d 0a eep-alive....
0x0000: 4500 00cb f95a 4000 4006 163c 0a01 0b58 E....Z#.#..<...X
0x0010: 0a01 0b3d d6a5 1388 ae92 8700 3d7b 996e ...=........={.n
0x0020: 8018 01c9 2b54 0000 0101 080a 183e 7f02 ....+T.......>..
0x0030: 34da 9ad9 7b22 6a73 6f6e 7270 6322 3a22 4...{"jsonrpc":"
0x0040: 322e 3022 2c22 6d65 7468 6f64 223a 2273 2.0","method":"s
0x0050: 656e 644d 6573 7361 6765 222c 2269 6422 endMessage","id"
0x0060: 3a31 2c22 7061 7261 6d73 223a 7b22 6163 :1,"params":{"ac
0x0070: 636f 756e 7449 4422 3a30 2c22 6d65 7373 countID":0,"mess
0x0080: 6167 6554 6578 7422 3a22 4974 2077 6173 ageText":"It.was
0x0090: 2061 2064 6172 6b20 616e 6420 7374 6f72 .a.dark.and.stor
0x00a0: 6d79 206e 6967 6874 2e22 2c22 636f 756e my.night.","coun
0x00b0: 7444 6f77 6e54 696d 6522 3a30 2c22 696e tDownTime":0,"in
0x00c0: 7465 7276 616c 223a 307d 7d terval":0}}
And this server apparently checks only for 'Host' (case sensitive) then throws an assertion error if it can't find it. Using curl, I've confirmed that the exact same request succeeds with the capitalized header name. Sadly, fixing this bad behavior in the (proprietary) server is not an option, so I have to make meteor send the values it expects.
I already tried setting the header like this:
result = Meteor.http.post(
api_endpoint,
{ headers: { 'Host': instance.host }, content: payload }
);
but the host header still gets sent in lowercase.
How do I override the host header properly?
Using meteor 0.6.5.1.
Make sure you update your code as the API changes, meteor is still in a preview release so stuff keeps changing. Meteor.http is now just HTTP.
So it looks like meteor converts headers to lowercase (see here). You need to alter some meteor packages to get it to work how you want.
Alter what you're looking for you need to make yourself a custom HTTP package.
1) Get the files over from https://github.com/meteor/meteor/blob/devel/packages/http/
2) Create a folder, if you don't aleady have one, called packages in your project's root directory and in it another directory HTTP
3) Add all the files you got from 1 in this HTTP directory.
4) run meteor add HTTP to override the default HTTP package with your one.
5) Alter the file httpcall_client.js at Line 143 (as at version Meteor 0.6.5.1) to alter the part that converts headers to lowercase so that they're used as is.
According to this answer, HTTP RFC 2616 states that header field names are case-insensitive, so the calling behavior is correct by spec.
If you are making the call from the client then try converting to a Meteor method and executing it on the server. Meteor client-side uses the
browser's XMLHttpRequest object so it will be browser-dependent. (You would see the same behavior using jQuery since it also uses the same browser objects.)
Meteor server-side uses Node's request function so first test that to see if it preserves case.
If not, since fixing the remote server is not possible, you will have to proxy the call through a server you control that can send the headers in the format required. That can either mean finding one that let's you control header case (maybe even dropping down to curl) or doing low-level string manip on the raw request.
So I think a plan of action is:
Test server-side Meteor.call
Find/write a proxy server
Replace the problem client-side calls with calls to your new proxy
Fix request headers en-route
Forward on to original end-point
Deal with responses
Hope that helps!

Resources