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
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...