# Javascript FAQs

Get answers to frequently asked Javascript connector questions.

What is the Workato JavaScript connector used for?

The Workato JavaScript connector allows you to write custom JavaScript code as part of your recipes. You can use it for tasks like data transformation and invoking external services.

What JavaScript runtime does the Workato JavaScript connector use?

The Workato JavaScript connector runs on Node.js version 14. It includes all JavaScript libraries available in Node.js version 14, as well as additional libraries such as:

  • node_fetch
  • lodash
  • gRPC
  • Google Protobuf
Is there a limit to the size of JavaScript scripts in the connector?

Yes. The JavaScript action supports scripts up to 1 MB in size. Scripts exceeding this limit continue to execute but may encounter memory limitations. The JavaScript action also times out after 30 seconds.

How do I define input fields in the Workato JavaScript connector?

Locate the Input fields section and select Add field to define input fields for your JavaScript code. You can map values to these input fields from previous steps in your recipe.

How are Date input fields passed to the JavaScript code?

Date input fields with the Date type are passed as strings to the JavaScript code. We recommend consuming date input by converting it to Date objects within your code.

How do I define the output schema for the JavaScript code being called?

To define the output schema, you can use one of two methods:

  • Use a sample JSON for schema generation.
  • Manually define the schema by adding fields, specifying data types, and determining which of these are optional.
What format should my JavaScript code follow in the exports.main function?

The JavaScript connector requires your code to be within the exports.main function. Your code must follow the CommonJS format and export the main function, which takes in data as input and returns the output.

Last updated: 3/20/2024, 7:37:41 PM