appwrite / appwrite/playground-for-node

🐛 Bug Report: Function create doesn't work

Open
#20 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
71
Forks
19
PR merge metrics
No merged PRs in 30d

Description

### 👟 Reproduction steps

1. Clone the repository.
2. Install dependency `npm install`.
3. Run start script `npm run start`.

Node: 18.15.0
node-appwrite: 9.0.0

### 👍 Expected behavior

According to the documentation, It should create the function.

### 👎 Actual Behavior

When I run `npm run start`, the creation of a function responds to an error:

```
Running Create Function API
AppwriteException [Error]: Invalid execute: Roles must be an array of strings.
at Client.call (/Applications/Back/playground-for-node/node_modules/node-appwrite/lib/client.js:172:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Functions.create (/Applications/Back/playground-for-node/node_modules/node-appwrite/lib/services/functions.js:111:16)
at async createFunction (/Applications/Back/playground-for-node/src/app.js:419:22)
at async runAllTasks (/Applications/Back/playground-for-node/src/app.js:537:5) {
code: 400,
type: 'general_argument_invalid',
response: {
message: 'Invalid execute: Roles must be an array of strings.',
code: 400,
type: 'general_argument_invalid',
version: '0.10.45'
}
}
```

The creation of the function:
```javascript
const createFunction = async () => {
console.log(chalk.greenBright('Running Create Function API'));

const response = await functions.create(
ID.unique(),
"Node Hello World",
[Role.any()],
"node-16.0"
);

functionId = response.$id;

console.log(response);
}
```

### 🎲 Appwrite version

Version 0.10.x

### 💻 Operating system

MacOS

### 🧱 Your Environment

_No response_

### 👀 Have you spent some time to check if this issue has been raised before?

- [X] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.