{"id":16193576,"url":"https://github.com/pyramation/python-template-openfaas-of-watchdog-issue","last_synced_at":"2025-04-07T15:19:36.979Z","repository":{"id":66351163,"uuid":"284406098","full_name":"pyramation/python-template-openfaas-of-watchdog-issue","owner":"pyramation","description":null,"archived":false,"fork":false,"pushed_at":"2020-08-02T07:16:54.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T02:03:53.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyramation.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-02T06:36:05.000Z","updated_at":"2020-08-02T07:16:57.000Z","dependencies_parsed_at":"2023-02-24T18:00:54.100Z","dependency_job_id":null,"html_url":"https://github.com/pyramation/python-template-openfaas-of-watchdog-issue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyramation%2Fpython-template-openfaas-of-watchdog-issue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyramation%2Fpython-template-openfaas-of-watchdog-issue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyramation%2Fpython-template-openfaas-of-watchdog-issue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyramation%2Fpython-template-openfaas-of-watchdog-issue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyramation","download_url":"https://codeload.github.com/pyramation/python-template-openfaas-of-watchdog-issue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675597,"owners_count":20977378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T08:15:34.600Z","updated_at":"2025-04-07T15:19:36.954Z","avatar_url":"https://github.com/pyramation.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple python server request body empty when using of-watchdog \n\n## Expected Behaviour\n\nwhen `POST`ing a request to a cloud funtion, the request body should be available inside the cloud function. Specifically, the header for `content-length` should be set and the data should be readable. \n\nWe should expect, for example, \n\n```\ncurl --header \"Content-Type: application/json\" \\\n  --request POST \\\n  --data '{\"a\":\"1\",\"b\":\"2\"}' \\\nhttp://localhost:31112/function/py2fn.openfaas-fn\n```\n\nto respond with:\n\n```\n{\"function\": \"ok\", \"params\": {\"a\": \"1\", \"b\": \"2\"} }\n```\n\n## Current Behaviour\n\nCurrently the response is missing the body completely. When I check content length it is not \u003e 0, hence the result:\n\n```\n{\"function\": \"ok\", \"params\": {} }\n```\n\narea of interest: https://github.com/pyramation/python-template-openfaas-of-watchdog-issue/blob/master/template/python3/index.py#L31-L34\n\n## Steps to Reproduce (for bugs)\n\n1. pull the template\n\n```sh\nfaas-cli template pull https://github.com/pyramation/python-template-openfaas-of-watchdog-issue\n```\n\n2. create a new functions\n\n```sh\nfaas-cli new --lang python2.7 py2fn\nfaas-cli new --lang python3 py3fn\n```\n\n3. build and deploy\n\nSince the functions are just passing through params, we can build and deploy them immediately:\n\n```sh\nexport OPENFAAS_URL=localhost:31112\nfaas build -f ./py2fn.yml\nfaas build -f ./py3fn.yml\nfaas deploy -f ./py2fn.yml\nfaas deploy -f ./py3fn.yml\n```\n\n4. make requests and see both have same result\n\n```sh\ncurl --header \"Content-Type: application/json\"   --request POST   --data '{\"a\":\"1\",\"b\":\"2\"}' http://localhost:31112/function/py2fn.openfaas-fn\n\u003e {\"function\": \"ok\", \"params\": {} }\n\ncurl --header \"Content-Type: application/json\"   --request POST   --data '{\"a\":\"1\",\"b\":\"2\"}' http://localhost:31112/function/py3fn.openfaas-fn\n\u003e {\"function\": \"ok\", \"params\": {} }\n```\n\n5. verify that it works locally, with proper responses\n\nFor python 2.7\n\n```sh\ncd ./build/py2fn\ntouch function/__init__.py \u0026\u0026 PORT=10101 python index.py\n\n# now on another shell...\ncurl --header \"Content-Type: application/json\"   --request POST   --data '{\"a\":\"1\",\"b\":\"2\"}' http://localhost:10101\n\u003e {\"function\": \"ok\", \"params\": {\"a\": \"1\", \"b\": \"2\"}}\n```\n\nFor python 3\n\n```sh\ncd ./build/py3fn\ntouch function/__init__.py \u0026\u0026 PORT=10101 python3 index.py\n\n# now on another shell...\ncurl --header \"Content-Type: application/json\"   --request POST   --data '{\"a\":\"1\",\"b\":\"2\"}' http://localhost:10101\n\u003e {\"function\": \"ok\", \"params\": {\"a\": \"1\", \"b\": \"2\"}}\n```\n\n## Context\n\nTrying to create languages for of-watchdog, so I can manipulate headers and create a connector that I'm working on in postgres. Currently nodejs works, so I'm a bit baffled by this body parsing issue.\n\n## Your Environment\n* Docker version 19.03.12\n* FaaS-netes\n* MacOS\n* https://github.com/pyramation/python-template-openfaas-of-watchdog-issue\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyramation%2Fpython-template-openfaas-of-watchdog-issue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyramation%2Fpython-template-openfaas-of-watchdog-issue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyramation%2Fpython-template-openfaas-of-watchdog-issue/lists"}