Basic I/O Function :Troubleshooting Tips

Basic I/O Function :Troubleshooting Tips

  1. Do check in your code whether you have used context.close() anywhere after the function block as it might close the function before sending the response. This might have caused you the issue. 
  2. The code within the function block will be executed only after the code outside the block is completed(normal Node.js behaviour). So we would suggest you to remove the basicIO.write() outside the function block as it might cause an error since data_output is not yet initialised. 
  3. Make sure not to perform any operations after basicIO.write() as it is used for sending response back from the function which indicates the end of function execution.
  4. If the issue persists even after the above points, you can use a try catch block in your code to catch the exception and find out the issue. 

You can find a sample Basic IO function for your operation as follows :

  1. const fetch = require('node-fetch');
  2. module.exports = (context, basicIO) => {
  3.     var data_output;
  4.     fetch('https://mms.zohosandbox.com/crm/v2/functions/mms__get_open_hours/actions/execute?auth_type=apikey&zapikey=1001.a9d79c98c63119fdad9fdfa1b910bead.71a47bc67b921811f2f5ce735aaab2a2')
  5.         .then(function (response) {
  6.             return response.json();
  7.         })
  8.         .then(function (myJson) {
  9.             data_output = JSON.stringify(myJson);
  10.             basicIO.write(data_output);
  11.             context.close();
  12.         });
  13. };

    • Related Articles

    • Basic I/O function doesn't accept request body

      you have created a Basic IO function for which you have sent the payload in request body. For Basic IO functions, the request data should be sent via the query parameters in GET method.
    • Basic I/O function in Nodejs to insert row in Catalyst Data Store

      const catalyst = require("zcatalyst-sdk-node"); module.exports = async(context, basicIO) => {     const tablename = "Students"     const app = catalyst.initialize(context);     let name = basicIO.getArgument("name");     let age = ...
    • Basic I/O function in Nodejs to insert row in Catalyst Data Store

      const catalyst = require("zcatalyst-sdk-node"); module.exports = async(context, basicIO) => {     const tablename = "Students"     const app = catalyst.initialize(context);     let name = basicIO.getArgument("name");     let age = ...
    • Credit Calculation Catalyst Function

      The 1500,1000 refers to the number of requests that can be executed concurrently.  On an average, 900 - 200 parallel invocations per minute will be the maximum number of function invocations depending on the execution time of 1 - 5s respectively. ...
    • Catalyst Function Execution and Performance

      You will only face higher execution time for function when it is called after a certain period of inactivity. If invoked continuously, you will not face the slowness. You can check the access logs for your function and check the average execution ...