FAQ - Server Extension

Server code gives me a timeout

Make sure to call the done() function at the end of your server code.

I've set a trigger-based hook for a bucket, but my server code did not launch correctly

Make sure that the bucket you've specified in the server hook configuration file is correct (e.g. the scope of the bucket is correct).

Failed to save KiiObjects by server code

Server code is executed with anonymous user privileges by default. Server code, therefore, cannot save any KiiObject in any buckets, including a bucket in the application scope.

Use the app administrator context in your server code. This will allow your server code to read and write data with the app administrator privileges. You can also execute a user login in your server code. This will allow your server code to read and write data with that user's privileges.

See User of Server Code for more details.

How to get the server timestamp?

You can get the server timestamp by leveraging the server extension. See Getting a Timestamp from the Server for sample server code.

Can anyone manually execute my server code?

Anyone, including an anonymous user, can manually execute server code.

As shown in the sample in Getting a Timestamp from the Server, you can determine if your server code is executed by a logged-in user or by an anonymous user by checking the existence of the access token. You can, therefore, implement safe server code by allowing your logic to be executed only when a logged-in user executes the code.

Can I use a language other than JavaScript to write server code?

No, we currently support only JavaScript.

Can I use the crypto module?

No, the crypt module is not supported from the performance point of view.

Where can I check an error log?

You can check the developer log using the command line tool.

See Inspect Developer Log for more details.

Can I get information of the host that has executed my server code?

You can send the host information as a parameter to server code when your application manually executes the server code.

Can I load some external modules in my server code?

You can use the modules listed in Available Modules and Syntax.