StackStorm / StackStorm/st2

Webhooks with '/' in them don't get routed to the controller

Open
#4,070 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug regression
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

CLI logs

(virtualenv) root@80fa4dcc1299:/st2# st2 --debug webhook get devices/config
# -------- begin 140399977822608 request ----------
curl -X GET -H  'Connection: keep-alive' -H  'Accept-Encoding: gzip, deflate' -H  'Accept: */*' -H  'User-Agent: python-requests/2.14.2' http://127.0.0.1:9101/v1/webhooks/devices/config
# -------- begin 140399977822608 response ----------
{
    "faultstring": "The resource could not be found."
}
# -------- end 140399977822608 response ------------

Webhook "devices/config" is not found.

CLI settings:
----------------
Config file path: /root/.st2/config
Client settings:
----------------
ST2_BASE_URL: http://127.0.0.1
ST2_AUTH_URL: http://127.0.0.1:9100
ST2_API_URL: http://127.0.0.1:9101/v1
ST2_STREAM_URL: http://127.0.0.1:9102/v1
ST2_AUTH_TOKEN: None

Proxy settings:
---------------
HTTP_PROXY:
HTTPS_PROXY:

Traceback (most recent call last):
  File "/st2/st2client/st2client/shell.py", line 343, in run
    func(args)
  File "/st2/st2client/st2client/commands/resource.py", line 334, in run_and_print
    raise OperationFailureException('Resource %s not found.' % resource_id)
OperationFailureException: Resource devices/config not found.
(virtualenv) root@80fa4dcc1299:/st2#

API logs

2018-04-06 16:21:38,093 140341107055824 DEBUG router [-] Match path: /v1/webhooks/devices/config
2018-04-06 16:21:38,095 140341107055824 DEBUG error_handling [-] API call failed: None (exception_message='The resource could not be found.',exception_data={'comment': None, '_headers': None, 'conditional_response': False, 'detail': None, '_app_iter': [''], '_status': '404 Not Found', '_headerlist': [('Content-Type', 'text/html; charset=UTF-8'), ('Content-Length', '0')]},exception_class='HTTPNotFound')
2018-04-06 16:21:38,098 140341107055824 DEBUG error_handling [-] Traceback (most recent call last):
  File "/st2/st2common/st2common/middleware/error_handling.py", line 49, in __call__
    raise exc.HTTPNotFound()
HTTPNotFound: The resource could not be found.

2018-04-06 16:21:38,099 140341107055824 DEBUG router [-] Match path: /v1/webhooks/devices/config
2018-04-06 16:21:38,101 140341107055824 INFO logging [-] 627fc307-795f-42b3-9580-be1e6bd062bb - 404 57 9.845ms (content_length=57,request_id='627fc307-795f-42b3-9580-be1e6bd062bb',runtime=9.845,remote_addr='127.0.0.1',status=404,method='GET',path='/v1/webhooks/devices/config')
2018-04-06 16:21:38,102 140341107055824 DEBUG logging [-] 627fc307-795f-42b3-9580-be1e6bd062bb - 404 57 9.845ms
{
    "faultstring": "The resource could not be found."
} (result='{\n    "faultstring": "The resource could not be found."\n}',content_length=57,request_id='627fc307-795f-42b3-9580-be1e6bd062bb',runtime=9.845,remote_addr='127.0.0.1',status=404,method='GET',path='/v1/webhooks/devices/config')

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the GET request for /v1/webhooks/devices/config from the CLI logs, then trace API routing and the failure through st2common/st2common/middleware/error_handling.py. Confirm how webhook names containing a slash are matched, and add coverage showing that such a webhook is routed successfully instead of returning 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.