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
- How to handle ghost accounts created by ...
Appwrite create the account with the email and send an invitation link with a secret. I am able to accept the invitation and add the account as a member on the ...
- Broken Appwrite can’t make functions nor...
Hii guys, I was having this issue with my locally hosted Appwrite, I can’t create functions ( both template and manual), I can’t make a custom domain ( like in ...
- Bulk operations on tables with relations
Hi, if I try to perform a bulk delete on a table with relations, I get this: `289 | if (((_b = response.headers.get("content-type")) == null ? void 0 : _...