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

fn invoke with java fdk helloworld gives 502 error #392

Closed
sachin-pikle opened this issue Aug 24, 2018 · 7 comments · Fixed by fnproject/fn#1192
Closed

fn invoke with java fdk helloworld gives 502 error #392

sachin-pikle opened this issue Aug 24, 2018 · 7 comments · Fixed by fnproject/fn#1192
Assignees

Comments

@sachin-pikle
Copy link

sachin-pikle commented Aug 24, 2018

I tried running a HelloWorld java using triggers and fn invoke... and I get a 502 in invoke.

fn init --runtime java --trigger http sac-java-t-fn

FN_REGISTRY=demouser fn -v deploy --app db-app --local --no-bump

curl http://localhost:8080/t/db-app/sac-java-t-fn-trigger

Curl works but I get a 502 error for Java helloworld fn invoke below:

fn invoke db-app sac-java-t-fn
{"message":"container exit code 2"}

Fn: Error calling function: status 502

See 'fn --help' for more information. Client version: 0.4.150

@zootalures
Copy link
Member

This is because the Java FDK is expecting FN_PATH and FN_REQUEST_URL to be set

Required environment variable FN_PATH is not set - are you running a function outside of fn run?

@zootalures
Copy link
Member

Invoke has changed the expected call contract and the Java FDK has not been updated to reflect that change.

@sachin-pikle
Copy link
Author

Is this an easy fix?

@michael-w-williams
Copy link
Member

I tried the same thing and I get a 404 "Route not found" error using either call or invoke. Curl works fine.

@michael-w-williams
Copy link
Member

More information after working on the node.js tutorial. Node.js is also giving me a 404 "Route not found" with fn call. The fn invoke command works fine. So taking the error message at face value I added a route:

fn create route nodeapp /nodefn fndemouser/nodefn:0.0.2

Now call works if you specify the content type. So fn call simply needs to look for a trigger rather than a route in the future.

@sachin-pikle
Copy link
Author

sachin-pikle commented Aug 28, 2018

Mike - Routes will be deprecated.
Routes uses fn call and Triggers uses fn invoke. So as long as fn invoke works we should not worry about routes as that is going away soon.

@gviedma-zz
Copy link

Note that this issue originates on the server-side (not on the CLI), and it affects all FDKs. A fix is available on fnproject/fn#1192

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

Successfully merging a pull request may close this issue.

6 participants