Hey,
So, you can disabled services. It also says this: When disabled, the services are not accessible to client SDKs but remain accessible to server SDKs.
Now when trying to do for example:
'use client'
import { useEffect } from 'react'
import { setOrgId } from '@/utils/actions/system/setOrgId'
export default function OrgChecks({ defaultOrgId }) {
useEffect(() => {
const setOrgIdIfNotPresent = async () => {
if (!defaultOrgId) {
await setOrgId()
}
}
setOrgIdIfNotPresent().then()
}, [defaultOrgId])
return null
}
Where the setOrgId:
'use server'
import { createSessionServerClient } from '@/app/appwrite-session'
import { cookies } from 'next/headers'
export async function setOrgId() {
const { teams } = await createSessionServerClient()
const teamsData = await teams.list().catch((error) => {
return error
})
console.log(teamsData)
cookies().set(`orgId`, teamsData.teams[0].$id, {
httpOnly: false,
secure: true,
sameSite: 'Lax',
//maxAge: new Date(session.expire),
path: '/',
domain: process.env.NEXT_PUBLIC_COOKIE_DOMAIN,
})
return teamsData
}
And the createSessionServerClient:
import { Teams } from 'node-appwrite'
import { headers } from 'next/headers'
export async function createSessionServerClient() {
const headersList = headers()
const cookieHeader = headersList.get('cookie')
const cookies = cookieHeader ? cookieHeader.split('; ') : []
const sessionCookie = cookies.find((cookie) =>
cookie.startsWith(
`a_session_${process.env.NEXT_PUBLIC_APPWRITE_DATABASES_PROJECT_ID}`
)
)
const client = new Client()
.setEndpoint(`${process.env.NEXT_PUBLIC_API_URL}/v1`)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_DATABASES_PROJECT_ID)
if (sessionCookie) {
client.setSession(sessionCookie.split('=')[1])
}
return {
get teams() {
return new Teams(client)
},
}
}
Now for some reason, it's saying: AppwriteException: The requested service is disabled. You can enable the service from the Appwrite console.
Why? It's still using the node-appwrite sdk yeah?
I'm guessing it's talking about server API KEYS and not the node-appwrite sdk? Because then it's written incorrectly. Otherwise it has to be an issue, right? But I can't get my head around it which way it's supposed to be:
Turn off services:
- Server API Keys only or
- Server SDK's only
Recommended threads
- AppwriteException: Invalid query: Query ...
```js console.log(typeof interaction.user.id) console.log(interaction.user.id) const user_check = await TablesDB.listRows({ databaseId: "db", ...
- Files access permissions
Am I right in understanding that file access permissions have been disabled (or broken again), and that shared access can now only be organized via tokens? Or i...
- functions custom domain issues in self h...
I’m running self-hosted Appwrite (Docker) behind Traefik with Cloudflare proxy (Full/Strict). Main domain works: https://app.printa4.in Function subdomains fa...