Appwrite icon

Appwrite

Interact with Appwrite API

Actions181

Functions → Create

AI-generated

Overview

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

  1. Creating a serverless function in Appwrite to process user data on a schedule.
  2. Setting up a function triggered by specific events like user creation or document updates.
  3. 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.
  • options
    • execute - 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

Discussion