henOriginal post
Rank 1: Thread
I am trying to setup local Appwrite instance for testing and managed to pull functions from cloud, now trying to use appwrite push to localhost for each of my functions, however one of the functions used newest tablesDB scopes in the cloud and it seems there is some issues with them locally (my other functions without tablesDB scopes worked okay).
Error:
AppwriteException [Error]: Invalid `scopes` param: Value must a valid array no longer than 100 items and Value must be one of (sessions.write, users.read, users.write, teams.read, teams.write, databases.read, databases.write, collections.read, collections.write, attributes.read, attributes.write, indexes.read, indexes.write, documents.read, documents.write, files.read, files.write, buckets.read, buckets.write, functions.read, functions.write, sites.read, sites.write, log.read, log.write, execution.read, execution.write, locale.read, avatars.read, health.read, providers.read, providers.write, messages.read, messages.write, topics.read, topics.write, subscribers.read, subscribers.write, targets.read, targets.write, rules.read, rules.write, migrations.read, migrations.write, vcs.read, vcs.write, assistant.read, tokens.read, tokens.write)
at Client.call (/opt/homebrew/Cellar/appwrite/9.1.0/libexec/lib/node_modules/appwrite-cli/lib/client.js:209:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async functionsCreate (/opt/homebrew/Cellar/appwrite/9.1.0/libexec/lib/node_modules/appwrite-cli/lib/commands/functions.js:175:16)
at async /opt/homebrew/Cellar/appwrite/9.1.0/libexec/lib/node_modules/appwrite-cli/lib/commands/push.js:1497:28
at async Promise.all (index 0)
at async pushFunction (/opt/homebrew/Cellar/appwrite/9.1.0/libexec/lib/node_modules/appwrite-cli/lib/commands/push.js:1443:5)
at async pushResources (/opt/homebrew/Cellar/appwrite/9.1.0/libexec/lib/node_modules/appwrite-cli/lib/commands/push.js:962:13) {
code: 400,
response: 'general_argument_invalid'
}
the problematic function config:
{
"$id": "shared-utils-test",
"execute": [
"any"
],
"name": "Shared Utils Test",
"enabled": true,
"logging": true,
"runtime": "node-22",
"scopes": [
"sessions.write",
"users.read",
"users.write",
"teams.read",
"teams.write",
"databases.read",
"databases.write",
"tables.read",
"collections.read",
"tables.write",
"collections.write",
"columns.read",
"attributes.read",
"columns.write",
"attributes.write",
"indexes.read",
"indexes.write",
"rows.read",
"documents.read",
"rows.write",
"documents.write",
"functions.read",
"functions.write",
"execution.read",
"execution.write"
],
"events": [],
"schedule": "",
"timeout": 15,
"entrypoint": "templates/main.js",
"commands": "npm install",
"specification": "s-1vcpu-512mb",
"path": "functions/Shared Utils Test"
}
I have newest appwrite cli version (9.1.0)
Summary
Developers using locally deployed functions with the Appwrite CLI may encounter issues with tablesDB scopes. The error "Invalid `scopes` param" occurs due to scopes that aren't supported locally. The solution is to remove unsupported scopes such as "tables.read" and "tables.write" from the function config. This will allow the function to be pushed successfully to localhost.