Bug: Liquid templating crashes when AW credential syntax is present in options
Version 0.8.1
If an AW credential is refenrenced in the options doc ({"api_key": {% credential ml_api_key %}}
, liquid templating causes an exception:
agent_tos_1 | 2021-02-23T10:35:32.670834170Z 172.23.0.11:57446 - "POST /tosexecutor HTTP/1.1" 500
agent_tos_1 | 2021-02-23T10:35:32.674125223Z [2021-02-23 11:35:32 +0100] [14] [ERROR] Exception in ASGI application
agent_tos_1 | 2021-02-23T10:35:32.674146338Z Traceback (most recent call last):
agent_tos_1 | 2021-02-23T10:35:32.674153959Z File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 396, in run_asgi
agent_tos_1 | 2021-02-23T10:35:32.674169904Z result = await app(self.scope, self.receive, self.send)
agent_tos_1 | 2021-02-23T10:35:32.674175670Z File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674181540Z return await self.app(scope, receive, send)
agent_tos_1 | 2021-02-23T10:35:32.674187040Z File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 190, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674192838Z await super().__call__(scope, receive, send)
agent_tos_1 | 2021-02-23T10:35:32.674198436Z File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674204445Z await self.middleware_stack(scope, receive, send)
agent_tos_1 | 2021-02-23T10:35:32.674210038Z File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674215961Z raise exc from None
agent_tos_1 | 2021-02-23T10:35:32.674227918Z File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674234387Z await self.app(scope, receive, _send)
agent_tos_1 | 2021-02-23T10:35:32.674359823Z File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674369069Z raise exc from None
agent_tos_1 | 2021-02-23T10:35:32.674374802Z File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674380563Z await self.app(scope, receive, sender)
agent_tos_1 | 2021-02-23T10:35:32.674386025Z File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
agent_tos_1 | 2021-02-23T10:35:32.674391670Z await route.handle(scope, receive, send)
agent_tos_1 | 2021-02-23T10:35:32.674397137Z File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
agent_tos_1 | 2021-02-23T10:35:32.674402748Z await self.app(scope, receive, send)
agent_tos_1 | 2021-02-23T10:35:32.674408113Z File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
agent_tos_1 | 2021-02-23T10:35:32.674413776Z response = await func(request)
agent_tos_1 | 2021-02-23T10:35:32.674419103Z File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 188, in app
agent_tos_1 | 2021-02-23T10:35:32.674451417Z raw_response = await run_endpoint_function(
agent_tos_1 | 2021-02-23T10:35:32.674457468Z File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 137, in run_endpoint_function
agent_tos_1 | 2021-02-23T10:35:32.674545850Z return await run_in_threadpool(dependant.call, **values)
agent_tos_1 | 2021-02-23T10:35:32.674593882Z File "/usr/local/lib/python3.8/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool
agent_tos_1 | 2021-02-23T10:35:32.674661187Z return await loop.run_in_executor(None, func, *args)
agent_tos_1 | 2021-02-23T10:35:32.674669650Z File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
agent_tos_1 | 2021-02-23T10:35:32.674675542Z result = self.fn(*self.args, **self.kwargs)
agent_tos_1 | 2021-02-23T10:35:32.674681122Z File "/app/tos_execute/main.py", line 103, in tos_executor
agent_tos_1 | 2021-02-23T10:35:32.674686919Z return receive(
agent_tos_1 | 2021-02-23T10:35:32.674734523Z File "/app/tos_execute/main.py", line 206, in receive
agent_tos_1 | 2021-02-23T10:35:32.674742601Z context = utils.dict_apply_recursive(
agent_tos_1 | 2021-02-23T10:35:32.674748167Z File "/app/tos_execute/utils.py", line 253, in dict_apply_recursive
agent_tos_1 | 2021-02-23T10:35:32.674753909Z result_dct[k] = func(v)
agent_tos_1 | 2021-02-23T10:35:32.674759322Z File "/app/tos_execute/main.py", line 208, in <lambda>
agent_tos_1 | 2021-02-23T10:35:32.674775977Z func=lambda x: env.from_string(x).render(received_context),
agent_tos_1 | 2021-02-23T10:35:32.674785800Z File "/usr/local/lib/python3.8/site-packages/liquid/environment.py", line 164, in from_string
agent_tos_1 | 2021-02-23T10:35:32.674791948Z parse_tree = self.parse(source)
agent_tos_1 | 2021-02-23T10:35:32.674797586Z File "/usr/local/lib/python3.8/site-packages/liquid/environment.py", line 139, in parse
agent_tos_1 | 2021-02-23T10:35:32.674816527Z parse_tree = parser.parse(TokenStream(token_iter))
agent_tos_1 | 2021-02-23T10:35:32.674823810Z File "/usr/local/lib/python3.8/site-packages/liquid/parse.py", line 100, in parse
agent_tos_1 | 2021-02-23T10:35:32.674829669Z error(self.mode, err, linenum=stream.current.linenum)
agent_tos_1 | 2021-02-23T10:35:32.674835447Z File "/usr/local/lib/python3.8/site-packages/liquid/mode.py", line 34, in error
agent_tos_1 | 2021-02-23T10:35:32.674841293Z raise exc
agent_tos_1 | 2021-02-23T10:35:32.674846645Z File "/usr/local/lib/python3.8/site-packages/liquid/parse.py", line 97, in parse
agent_tos_1 | 2021-02-23T10:35:32.674852351Z if node := self.parse_statement(stream):
agent_tos_1 | 2021-02-23T10:35:32.674858826Z File "/usr/local/lib/python3.8/site-packages/liquid/parse.py", line 116, in parse_statement
agent_tos_1 | 2021-02-23T10:35:32.674869636Z node = tag.get_node(stream)
agent_tos_1 | 2021-02-23T10:35:32.674879285Z File "/usr/local/lib/python3.8/site-packages/liquid/tag.py", line 46, in get_node
agent_tos_1 | 2021-02-23T10:35:32.674890303Z self.env.error(err)
agent_tos_1 | 2021-02-23T10:35:32.674913942Z File "/usr/local/lib/python3.8/site-packages/liquid/environment.py", line 226, in error
agent_tos_1 | 2021-02-23T10:35:32.674926803Z raise exc
agent_tos_1 | 2021-02-23T10:35:32.674936526Z File "/usr/local/lib/python3.8/site-packages/liquid/tag.py", line 41, in get_node
agent_tos_1 | 2021-02-23T10:35:32.674947250Z return self.parse(stream)
agent_tos_1 | 2021-02-23T10:35:32.674957120Z File "/usr/local/lib/python3.8/site-packages/liquid/builtin/illegal.py", line 25, in parse
agent_tos_1 | 2021-02-23T10:35:32.674968194Z raise LiquidSyntaxError(f"unexpected tag '{tok.value}'", linenum=tok.linenum)
agent_tos_1 | 2021-02-23T10:35:32.674977996Z liquid.exceptions.LiquidSyntaxError: unexpected tag 'credential', on line 1