fdk-java icon indicating copy to clipboard operation
fdk-java copied to clipboard

JSON Enabled function returns Error when Empty value is passed

Open michael-w-williams opened this issue 7 years ago • 3 comments

After the adding JSON support for Java Fn function, if the function is passed an empty value, Fn returns:

{"message":"container exit code 2"}

Fn: Error calling function: status 502

The function does work with JSON data. If you pass:

{"name":"Bob"}

or even

{"name":""}

the function works fine. Tried modifying the function to test for null and isEmpty. Nothing like that worked. I'm guessing the function is throwing an uncaught exception.

May be related to 392 or 1192

Mike W.

michael-w-williams avatar Sep 07 '18 16:09 michael-w-williams

The error is pretty clear that an attempt to convert null to an an object failed. Null input should result in a null object passed to the function handler.

{ "message":"Unhandled internal error in FDK", "detail":"An exception was thrown during Input Coercion: Failed to coerce event to user function parameter type class com.example.fn.HelloFunction$Input"}

shaunsmith avatar Oct 17 '18 21:10 shaunsmith

@rikgibson can you take a look at this? I'd rather we fixed this bug than have to add warning text to the Java tutorial (https://github.com/fnproject/tutorials/pull/149).

shaunsmith avatar Dec 12 '18 16:12 shaunsmith

What is the status on this issue?

CC007 avatar Jul 17 '20 22:07 CC007