Error on service after upgrading to 2.1

I have a service that is a passthrough to a geolocation api. It was working fine before (in both a 1.x DSP and the 2.04 DSP) but after upgrading to 2.1 I am now getting this error:

“Argument 1 passed to DreamFactory\Library\Utility\ArrayUtils::get() must be of the type array, null given, called in /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-rws/src/Services/RemoteWeb.php on line 216 and defined”

After upgrade to 2.1, I not able to return any data with a custom scripting service.

Just for example, using 2.0.4, this v8js script works fine:

return {“test”:“ok”};

but after upgrading to 2.1, i get a blank response. No errors in df log.

Getting the same error as @greywire here… and also noticed the same problem as @andersonmuller

@greywire @Elvis_Fernandes Yep, it is a bug. Workaround is to add an option (default one from clicking the + is fine), save the service, then remove the option and save again and it should work. Seems the API is not handling no config for the option well. Will be fixed in the next release.

1 Like

@andersonmuller 2.1.0 has a couple of “breaking” changes documented in the release notes on the wiki.

“Event Scripting post-process scripts, and custom scripting services (V8Js, NodeJs, and PHP) now utilize a “event.response” object that allows for custom status code and content type settings. Scripts should no longer use return statements to return data.”

Thanks @leehicks,

Sorry, I missed that in release notes, but, please update the wiki :slightly_smiling:
https://wiki.dreamfactory.com/DreamFactory/Features/Scripting
https://wiki.dreamfactory.com/DreamFactory/Features/Scripting/V8Js

here it is already updated: https://wiki.dreamfactory.com/DreamFactory/Tutorials/V8_custom_scripting_service

Any update to the PHP tut?

Yep, that workaround fixes the problem…