Skip to content

fn invoke with java fdk helloworld gives 502 error  #392

Description

@sachin-pikle

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

Activity

  1. zootalures commented on Aug 24, 2018

    @zootalures
    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?
    
  2. zootalures commented on Aug 24, 2018

    @zootalures
    Member

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

  3. sachin-pikle commented on Aug 24, 2018

    @sachin-pikle
    Author

    Is this an easy fix?

  4. michael-w-williams commented on Aug 24, 2018

    @michael-w-williams
    Member

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

  5. michael-w-williams commented on Aug 27, 2018

    @michael-w-williams
    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.

  6. sachin-pikle commented on Aug 28, 2018

    @sachin-pikle
    Author

    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.

  7. self-assigned this
    on Aug 29, 2018
  8. gviedma-zz commented on Aug 29, 2018

    @gviedma-zz

    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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions