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
- TablesDB `updateRows` returns `database_...
Hi Appwrite team! I’m seeing a strange issue with TablesDB bulk row updates on a self-hosted Appwrite instance. **Environment** - Appwrite self-hosted `1.9.0` ...
- [SOLVED] Realtime Missing Channels
```js useEffect(() => { let subscription: RealtimeSubscription; async function loadChips() { try { const {rows: chi...
- Functions executed by events does not ap...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). When functions are triggered by an event (eg. databases.\*tables.\*.rows.\*.create) doe...