Rank 2: Process
Sometimes not often this error occurs.
What puzzled me was that I used the setKey method for authorization, but there was an error with JWT expiration.
Key Code Fragments:
// libs/nodeAppwrite.ts
import {
Client,
Account,
Databases,
ID,
Permission,
Role,
Query,
Users,
} from 'node-appwrite'
// others
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT)
.setKey(process.env.APPWRITE_API_KEY)
const database = new Databases(client)
// others
const database = new Databases(client)
// pages/api/getDocument.ts
import nodeAppwrite from '@/libs/nodeAppwrite'
// others
const documentRes = (await nodeappwrite.database.getDocument(
process.env.NEXT_PUBLIC_APPWRITE_DATABASE_ID,
process.env.NEXT_PUBLIC_APPWRITE_PAYMENTS_COLLECTION_ID,
documentId
)) as any
// others