Cordova Plugin Across Environments


We have a Cordova plugin which works on the production environment, but not on the development env. Any idea why this might happen? This is a custom made plugin, but all other plugins (flashligh for example) work on both. when I try to call the object on this plugin in the development environment the platform says:

"Can't read property print of undefined".

Are there any configuration settings I am missing on Service Center? The plugin taken for reference is the following:

Any ideas?

Hello Carlos.

It seems that on your development environment the plugin was not included in the generated app (remember it won't work on OutSystems Now). Make sure you have all the references to your plugins correct. Also, make sure all the Extensibility Configurations are correct. If it works on one environment, should definitely work on the other one too.


Hi Cesar

Thank you for the response. I am testing the app by generating the APK, not in Outsystems Now so that's not a problem. I got the plugin included in the app, however the plugin gives back an error "Zebra Plugin is Unavailable". That error is returned upon executing the following JS code:

$parameters.PluginExists = false;

if (cordova && cordova.plugins) {
    $parameters.PluginExists = (typeof(cordova.plugins.EstafetaZebraPlugin) !== "undefined");

I checked the "if (cordova)" and it returns true, however the "if(cordova.plugins)" and the next line of code both return false. That is what is leading me to think that Cordova settings might somewhow differ on the environments. Thanks in advance for the attention.



Hello Carlos.

When are you executing these actions? Can you create a very simple app, referencing the plugin, with just a button that onclick checks if the plugin is available?


Hello Cesar

That is exactly what I did, and that is how I know that is the piece of code that is causing us trouble in the dev environment. I can share the OMLs if they are needed. Any ideas? Is it possible it might have something to do with the server settings outside the Outsystems platfrom? Permisions on some specific folder, or Apache settings or something to do with that?



Update: I did a re-check of other plugins, such as the flashlight plugin and it is showing undefined as well. I re-generated and re-installed the app. It seems that the plugins are not being included in the generated app. I followed the instructions on this video to generate the plugin. Any ideas? Thanks in advance for the help. 

PS. I'm attachin the OMLs of both the app and the plugin on both envs.


Update #2

Turns out it didn't have to do anything with the environment or the plugin as such. Apparently the common plugin sometimes presents erratic behavior and that makes for unexpected behavior. The steps to fix this were:

  • Go into the "Common Plugin"
  • Go to the "IsCordovaDefined" action flow
  • Move any element in the canvas flow (just move not change connections or anything else) and publish the "Common Plugin"
  • Go into the plugin that was presenting difficulties, update its references and publish it
  • Update the references of the app that was using the plugin and pubish it
  • Generate the apk and install again

Hello Carlos.

Glad to know you made it work. 

Thanks for sharing the fix, great work