try {
const response = await databases.createCollection('6583e3cd3184170786fb', '2ndStore', '2ndStore',
['role:all'],
['role:all'],
attributes);
console.log(response);
res.status(200).json(response);
} catch (error) {
console.error(error);
res.status(500).json({ message: 'Error creating collection', error });
}
Gives: AppwriteException [Error]: Invalid permissions param: Invalid permission string format: "read".
How do i set roles?
Role.all doesn't exists. I think you mean Role.any()
Doesnt work
Could you please tell me how to set permissions to all while creating a collection
It's not specified in docs, but I think you need to do that through a function instead of client side
Oh
So it couldnt be done via node sdk?
Also to create collections it will be needed to do that server side instead of client side
Yeh i am trying to get it done from the server side only
export async function POST(req, res) {
const url = new URL(req.url, `http://${req.headers.host}`);
const sdk = require('node-appwrite');
const client = new sdk.Client();
const databases = new sdk.Databases(client); const attributes = [ { "type": "string", "key": "Data", "label": "Data", "required": false, "array": false },
]; client .setEndpoint('https://cloud.appwrite.io/v1') .setProject('') .setKey('') ;
try {
const response = await databases.createCollection('6583e3cd3184170786fb', '2ndStore', '2ndStore',
['Role.any()'],
attributes);
console.log(response);
res.status(200).json(response);
} catch (error) {
console.error(error);
res.status(500).json({ message: 'Error creating collection', error });
}
}
here is what i am trying to do
@D5 sir?
Is this an appwrite function?
If you run this in an AW function there should not be any issues
Nope its not an AW function
[ Permission.read(sdk.Role.any()),
],
using this worked
Recommended threads
- I'm getting error Invalid `url` param: I...
``` 2025-10-26T12:52:02.292Z [error] AppwriteException: Invalid `url` param: Invalid URI. Register your new client (vercel.com) as a new Web platform on your pr...
- 🚨 Access Restricted Despite Active Cred...
Hello Appwrite Support Team, My organization “Dreamo World Entertainment” currently shows an “Access Restricted” warning due to unpaid invoices. However, my bi...
- Deploy tanstack-start on site
- I am trying to deploy my project build with tanstack-start on site. - issue i am facing is appwrite doesnt provide start command option so i can run 'npm run ...