Actions181
- Account Actions
- Get Account
- Create Account
- Update Email
- Update Name
- Update Password
- Update Phone
- Update Status
- Get Preferences
- Update Preferences
- List Sessions
- Delete Sessions
- Get Session
- Update Session
- Delete Session
- Create Anonymous Session
- Create Email/Password Session
- Create Magic URL Session
- Create OAuth2 Session
- Create Phone Session
- Create Session from Token
- Create JWT
- Create Magic URL
- Create Phone Token
- Create Email Verification
- Update Email Verification
- Create Phone Verification
- Update Phone Verification
- Create Password Recovery
- Update Password Recovery
- Create Recovery
- Update Recovery
- Update MFA
- Create MFA Authenticator
- Update MFA Authenticator
- Delete MFA Authenticator
- Create MFA Challenge
- Update MFA Challenge
- Attribute Actions
- Avatars Actions
- Collection Actions
- Database Actions
- Document Actions
- Functions Actions
- Index Actions
- Locale Actions
- Messaging Actions
- Sites Actions
- Storage Actions
- Teams Actions
- Users Actions
Functions → Create
AI-generatedOverview
This node interacts with the Appwrite API to create a new function within the Appwrite environment. It allows users to define a function with a unique ID, name, runtime environment, and various optional settings such as execution permissions, event triggers, scheduling, timeout, logging, and source code repository details. This node is useful for automating backend logic, event-driven workflows, or scheduled tasks in an Appwrite project.
Use Case Examples
- Creating a serverless function in Appwrite to process user data on a schedule.
- Setting up a function triggered by specific events like user creation or document updates.
- Deploying a function with custom runtime and build commands from a version control repository.
Properties
| Name | Meaning |
|---|---|
| Function ID | The unique identifier for the function, which can be generated automatically using unique(). This ID is used to reference the function within Appwrite. |
| Name | The name of the function, which is required and limited to 128 characters. It identifies the function in the Appwrite project. |
| Runtime | The execution runtime environment for the function, such as Node.js, PHP, Python, Ruby, Dart, .NET, Java, Swift, Kotlin, C++, Bun, or Deno. This determines the language and version the function will run on. |
| Options | A collection of optional settings for the function, including execution permissions, event triggers, scheduling, timeout, enabled state, logging, entrypoint file, build commands, and version control system (VCS) integration details such as installation ID, repository ID, branch, silent mode, root directory, and template repository information. |
Output
JSON
functionId- The unique identifier of the created function.name- The name of the created function.runtime- The runtime environment selected for the function.optionsexecute- Execution permissions for the function.events- Event triggers for the function.schedule- Cron schedule for automatic execution.timeout- Maximum execution time in seconds.enabled- Whether the function is enabled.logging- Whether logging is enabled.entrypoint- Entrypoint file for the function.commands- Build commands to execute.installationId- VCS installation ID for Git integration.providerRepositoryId- VCS repository ID.providerBranch- VCS branch name.providerSilentMode- Whether to skip commit status updates.providerRootDirectory- Path to function code in repository.templateRepository- Template repository URL.templateOwner- Template repository owner ID.templateRootDirectory- Path to template in repository.templateBranch- Template branch name.
Dependencies
- Appwrite API key credential
Troubleshooting
- Ensure the Appwrite API credentials (endpoint, project ID, API key) are correctly configured to avoid authentication errors.
- Verify that the function ID is unique to prevent conflicts when creating a new function.
- Check that the runtime environment selected is supported and correctly specified.
- If using VCS integration, ensure the installation ID, repository ID, branch, and other related fields are accurate and accessible.
- Timeout errors may occur if the function execution exceeds the specified maximum time; adjust the timeout setting accordingly.
- Enable logging to help diagnose issues during function execution.
Links
- Appwrite Functions Documentation - Official documentation for creating and managing functions in Appwrite.