Skip to content
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

Function failed to deploy with status code: 500 #1831

Closed
springCozyRock opened this issue Jan 21, 2024 · 2 comments
Closed

Function failed to deploy with status code: 500 #1831

springCozyRock opened this issue Jan 21, 2024 · 2 comments

Comments

@springCozyRock
Copy link

I was deploying my first python function with OpenFaas, but failed.

my environment: k3d + openFaas on Mac

  • k3d version v5.6.0, k3s version v1.27.5-k3s1 (default)
  • openFaas version: 0.16.21

What I've got --

beatles@xxxxxsMBP openfaas % faas-cli deploy -f ./cpu.yml          
Deploying: float-operation.
WARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.

Is OpenFaaS deployed? Do you need to specify the --gateway flag?
Put "http://gateway.openfaas:8080/system/functions": dial tcp: lookup gateway.openfaas: no such host

Function 'float-operation' failed to deploy with status code: 500

I have checked stack overflow, and troubleshooting handbook, but still not work. Following are some information I got.

beatles@xxxxsMBP openfaas % faas-cli logs float-operation 
Cannot connect to OpenFaaS on URL: http://127.0.0.1:8080
beatles@xxxxMBP openfaas % kubectl get service -n openfaas

NAME               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
alertmanager       ClusterIP   10.43.116.214   <none>        9093/TCP         15d
gateway-external   NodePort    10.43.191.86    <none>        8080:31112/TCP   15d
gateway            ClusterIP   10.43.216.241   <none>        8080/TCP         15d
nats               ClusterIP   10.43.163.95    <none>        4222/TCP         15d
prometheus         ClusterIP   10.43.131.242   <none>        9090/TCP         15d

I supposed it might be a gateway problem, but I don't know how it actually works.
I also have checked @alexellis 's tutorial video, I saw he used -g https://openfaas.o6s.io but I don't know what this string supposed to be in my case?

@springCozyRock
Copy link
Author

springCozyRock commented Jan 25, 2024

update: I am so excited that my error message changed! I was so depressed (even cried yesterday) these days because of my noncommittal program and something else~

so what I've done is digging in the reference of gateway. I found that to access ui (http://localhost:31112/ui/) before, I followed a tutorial on the internet, and port Forwarding from 127.0.0.1:31112 -> 8080, basically run --

kubectl port-forward svc/gateway -n openfaas 31112:8080 &
export OPENFAAS_URL=http://127.0.0.1:31112
echo $PASSWORD | faas-cli login --password-stdin

then I got the light, and tried faas-cli deploy -f ./cpu.yml --gateway=http://localhost:31112

the error message changed!!!!

beatles@xxxxxsMBP openfaas % faas-cli deploy -f ./cpu.yml --gateway=http://localhost:31112
Deploying: float-operation.

unauthorized access, run "faas-cli login" to setup authentication for this server

Function 'float-operation' failed to deploy with status code: 401

I suppose I almost succeed. Let me fix it, and I will close the issue.

@springCozyRock
Copy link
Author

very easy then!!

beatles@xxxxxsMBP openfaas % faas-cli login --username admin --password=681d0e42c1506c260eba6cc73ad61b3330276302 --gateway=http://localhost:31112

WARNING! Using --password is insecure, consider using: cat ~/faas_pass.txt | faas-cli login -u user --password-stdin
Calling the OpenFaaS server to validate the credentials...
credentials saved for admin http://localhost:31112
beatles@xxxxxxsMBP openfaas % faas-cli deploy -f ./cpu.yml --gateway=http://localhost:31112
Deploying: float-operation.

Deployed. 202 Accepted.
URL: http://localhost:31112/function/float-operation

cheers!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant