Blog

How to Deploy Cloud Code Event Handlers to Backendless Servers

by on September 1, 2019

Previously, we wrote how to generate custom business logic code for API event handlers and how to locally debug your custom code. Now your code is ready to be pushed to the Backendless servers. Once it is out there, the Backendless infrastructure automatically handles scaling the code execution and routing requests to an instance available to run your code.

The process for deploying an API event handler is very similar to the one for timers (see deploying custom business logic in timers to Backendless).

The ZIP file you downloaded from the Backendless Console (when it generated the code for an event handler) includes the deploying utility located in the /bin directory. To deploy the code, open a command prompt window and run the Deploy script. There are two of them, one for Linux (Deploy.sh) and the other for Windows (Deploy.bat). When you run the utility, it inspects all the custom code, then packages and deploys it to the Backendless servers. The utility output would look similar to the one below:

macbook-pro-2:bin mark$ ./Deploy.sh
[INFO] CodeRunner(tm) Backendless Debugging Utility
[INFO] Copyright(C) 2015 Backendless Corp. All rights reserved.
[INFO] Version: 1.13 Build date: 20150320-1727
[INFO] Registering runner on: https://api.backendless.com with secretKey: XXXX-XXXX-XXXXX
[INFO] Runner successfully registered
[INFO] Parsing event model...
[INFO] Build successfully: EventModel{timers=0, eventHandlers=1}
[INFO] Deploying model to server, and starting debug...
[INFO] Model successfully deployed...
[INFO] Waiting for events...
[INFO] Deploying 1 event handler and 0 timers to the server…
[INFO] Successfully deployed all event handlers and timers.
[INFO] If you connected to coderunner for debug - please stop debugging
[INFO] CodeRunner will shutdown now
[INFO] Debugging Utility disconnected successfully
[INFO] Thank you for using Backendless

Additionally, once the code is deployed, you can confirm it using the Backendless Console. To do this, open the Production tab in the Business Logic (Cloud Code) screen. Make sure to select the appropriate category of the event handlers (it is Users in the screenshot below):

Leave a Reply