/functions/{functionId}Alcance functions.writeSDK: solo @owbase/node
Update function by its unique ID.
El despliegue es solo por subida: los parámetros de repositorio Git quedan fuera (consulta Empaquetar y subir el código).
Parámetros
Sección titulada «Parámetros»functionId string obligatorio
Function ID.
name string obligatorio
Function name. Max length: 128 chars.
runtime Runtime
Execution runtime. Valores: node-22 (solo Node 22 en Owbase).
execute string[]
An array of role strings with execution permissions. By default no user is granted with any execute permissions. learn more about roles. Maximum of 100 roles are allowed, each 64 characters long.
events string[]
Events list. Maximum of 100 events are allowed.
schedule string
Schedule CRON syntax. Cannot be combined with interval.
timeout number
Maximum execution time in seconds.
enabled boolean
Is function enabled? When set to ‘disabled’, users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
logging boolean
When disabled, executions will exclude logs and errors, and will be slightly faster.
entrypoint string
Entrypoint File. This path is relative to the “providerRootDirectory”.
commands string
Build Commands.
scopes ProjectKeyScopes[]
List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 scopes are allowed. Valores: project.read, project.write, usage.read, keys.read, keys.write, platforms.read, platforms.write, mocks.read, mocks.write, policies.read, policies.write, project.policies.read, project.policies.write, project.oauth2.read, project.oauth2.write, templates.read, templates.write, stages.read, stages.write, users.read, users.write, sessions.read, sessions.write, teams.read, teams.write, databases.read, databases.write, tables.read, tables.write, columns.read, columns.write, indexes.read, indexes.write, rows.read, rows.write, embeddings.write, collections.read, collections.write, attributes.read, attributes.write, documents.read, documents.write, documentsdb.read, documentsdb.write, documentsdb.collections.read, documentsdb.collections.write, documentsdb.documents.read, documentsdb.documents.write, documentsdb.indexes.read, documentsdb.indexes.write, vectorsdb.read, vectorsdb.write, vectorsdb.collections.read, vectorsdb.collections.write, vectorsdb.documents.read, vectorsdb.documents.write, vectorsdb.indexes.read, vectorsdb.indexes.write, buckets.read, buckets.write, files.read, files.write, tokens.read, tokens.write, functions.read, functions.write, executions.read, executions.write, execution.read, execution.write, sites.read, sites.write, log.read, log.write, providers.read, providers.write, topics.read, topics.write, subscribers.read, subscribers.write, targets.read, targets.write, messages.read, messages.write, rules.read, rules.write, webhooks.read, webhooks.write, monitors.read, monitors.write, alerts.read, locale.read, avatars.read, avatars.write, health.read, assistant.read, migrations.read, migrations.write, schedules.read, schedules.write, vcs.read, vcs.write, insights.read, insights.write, reports.read, reports.write, reviews.read, reviews.write, presences.read, presences.write.
buildSpecification string
Build specification for the function deployments.
runtimeSpecification string
Runtime specification for the function executions.
deploymentRetention number
Days to keep non-active deployments before deletion. Value 0 keeps all deployments unless the server applies a default retention.
interval number
Minutes between scheduled executions. Owbase picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule. When omitted, the current interval is kept unless schedule is set.
description string
Optional description for the function.
Acceso: clave de API con el alcance functions.write.
Respuestas
Sección titulada «Respuestas»200Éxito400Parámetro inválido o faltante401Sin sesión, sin permiso en el recurso o clave sin el alcance404Recurso de la ruta no encontrado429Límite de peticionesTodo error llega como JSON con code, type y message: consulta Errores.
import { Client, Functions, Runtime, ProjectKeyScopes } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const functions = new Functions(client);
const result = await functions.update({ functionId: '<FUNCTION_ID>', name: '<NAME>', runtime: Runtime.Node22, // optional execute: ['any'], // optional events: [], // optional schedule: '0 0 * * *', // optional timeout: 1, // optional enabled: false, // optional logging: false, // optional entrypoint: '<ENTRYPOINT>', // optional commands: '<COMMANDS>', // optional scopes: [ProjectKeyScopes.ProjectRead], // optional buildSpecification: 's-1vcpu-512mb', // optional runtimeSpecification: 's-1vcpu-512mb', // optional deploymentRetention: 0, // optional interval: 0, // optional description: '<DESCRIPTION>', // optional});curl -X PUT "https://cloud.owbase.dev/v1/functions/<FUNCTION_ID>" \ -H "X-Owbase-Project: <PROJECT_ID>" \ -H "X-Owbase-Key: $OWBASE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"<NAME>"}'{ "$id": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "execute": [ "users" ], "name": "My Function", "description": "Sends a welcome email to newly registered users.", "enabled": false, "live": false, "logging": false, "runtime": "python-3.8", "deploymentRetention": 7, "deploymentId": "5e5ea5c16897e", "deploymentCreatedAt": "2020-10-15T06:38:00.000+00:00", "latestDeploymentId": "5e5ea5c16897e", "latestDeploymentCreatedAt": "2020-10-15T06:38:00.000+00:00", "latestDeploymentStatus": "ready", "scopes": [ "users.read" ], "vars": [ { "$id": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "key": "API_KEY", "description": "Stripe secret key used at checkout.", "value": "myPa$$word1", "secret": false, "resourceType": "function", "resourceId": "myAwesomeFunction" } ], "events": [ "account.create" ], "schedule": "5 4 * * *", "interval": 60, "timeout": 300, "entrypoint": "index.js", "commands": "npm install", "version": "v2", "installationId": "6m40at4ejk5h2u9s1hboo", "providerRepositoryId": "owbase", "providerBranch": "main", "providerRootDirectory": "functions/helloWorld", "providerSilentMode": false, "providerBranches": [ "main", "feat/*" ], "providerPaths": [ "src/**", "!docs/**" ], "buildSpecification": "s-1vcpu-512mb", "runtimeSpecification": "s-1vcpu-512mb"}Las descripciones de esta página vienen de la especificación de la API del servidor (licencia BSD-3-Clause), en inglés, y los ejemplos vienen del generador de SDKs (licencia MIT). Los avisos completos están en el archivo NOTICE de los paquetes @owbase/web y @owbase/node.