CloudCode Overview
CloudCode is a JourneyApps feature to run JavaScript or TypeScript "tasks" in the cloud, instead of on a mobile device.
Typical use cases include:
- Basic integration with external services
- Bulk operations such as archiving data
- Generating reports, such as CSV files, PDF reports or Excel spreadsheets
- Sending emails
- Scheduled tasks
CloudCode tasks are NodeJS-based. The specific NodeJS version depends on the CloudCode task version:
- Task versions 1.12.x use NodeJS 16
- Task versions 1.11.x use NodeJS 14
- [Deprecated] Task versions 1.10.x use NodeJS 12
CloudCode task versions
A CloudCode task version can be configured by right-clicking on the task name in OXIDE and selecting CloudCode task settings.
CloudCode makes extensive use of async & await. For an introduction, see this Async & Await section.
All CloudCode tasks run on servers managed by Amazon Web Services (AWS).
Basic CloudCode task structure
A basic task has the following structure:
export async function run() {
// Your code here
}
CloudCode tasks can be triggered in one of following ways:
- Via the Test CloudCode Task action in OXIDE
- Via a webhook
- Via HTTP
- Enqueued from another task
- Directly from an App
- On a schedule
The following packages are available in each CloudCode task by default:
node-fetch
(exposed as afetch
global function).aws-sdk
- Each task invocation can run for a maximum of 5 minutes.
- Each task invocation has a limit of 1024MB memory.
- Each task can run multiple times in parallel.
- When invoking a task, parameters are converted using
JSON.stringify
and the resulting string should not exceed 5MB. - Web Tasks accept a maximum
body
size of 5MB for incoming requests, and will return HTTP 413 if this is exceeded.
Last modified 7mo ago