FAQ - Server Extension
- Server code gives me a timeout
- I've set a trigger-based hook for a bucket, but my server code did not launch correctly
- Failed to save KiiObjects by server code
- How to get the server timestamp?
- Can anyone manually execute my server code?
- Can I use the crypto module?
- Where can I check an error log?
- Can I get the information of the host that has executed my server code?
- Can I load some external modules in my server code?
Make sure to call the done() function at the end of your server code.
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).
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.
You can get the server timestamp by leveraging the server extension. See Getting a Timestamp from the Server for sample 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.
No, the crypt module is not supported from the performance point of view.
You can check the developer log using the command line tool.
See Inspect Developer Log for more details.
You can send the host information as a parameter to server code when your application manually executes the server code.
You can use the modules listed in Available Modules and Syntax.