-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdin is passed incorrectly #14
Comments
Hi, thanks for your interest. I'm not clear what you're trying to do here, or what you're trying to say, but this template has been used extensively over years. You'll need to post your function's source code so we can see if this is something we want to support or not. Alex |
The Python script receives different bytes via stdin if called by watchdog. It's not about the template. I just used the template The change of the input might be caused by faas-cli, watchdog or anything in between. The issue does not occur with the Python Flask Templates, which use of-watchdog instead of I assume, this issue exists with every template that uses |
I checked something similar today. I deployed the faas-cli invoke alpine --gateway https://faasd.dieschulapp.de < hello.zip > hello.zip.copy
cmp hello.zip hello.zip.copy
diff hello.zip hello.zip.copy According to
I changed from pathlib import Path
if __name__ == "__main__":
print(Path('/dev/stdin').read_bytes()) and get the same results for python index.py < hello.zip and faas-cli invoke is-zip < hello.zip This issue might be related to Python, the (Python) environment, |
I found out that $ python index.py < hello.zip
True
$ cat hello.zip | python index.py
False
from pathlib import Path
from tempfile import NamedTemporaryFile
from zipfile import is_zipfile
if __name__ == "__main__":
with NamedTemporaryFile() as temp_file:
temp_file.write(stdin.read_bytes())
temp_file.flush()
file = Path(temp_file.name)
print(is_zipfile(file)) |
No problem. Can I ask what your use-case is for OpenFaaS? Are you a user already or considering using it for a new project? |
Steps to Reproduce (for bugs)
Pull python3-debian template from store. Replace
index.py
withCreate a ZIP file:
A direct call without Watchdog should look like this
$ python index.py < hello.zip True
Now deploy a function
is-zip
with the template (usesfwatchdog
to callpython3 index.py
).Expected Behaviour
$ faas-cli invoke is-zip < hello.zip True
Current Behaviour
$ faas-cli invoke is-zip < hello.zip False
Context
Related to openfaas/templates#205
Your Environment
Docker version:
25.0.3
Kubernetes
Operating System and version: MacOS 14.3.1 (23D60)
The text was updated successfully, but these errors were encountered: