Skip to content
Init is here / May 19 - 23
Back

401 Unauthorized

  • 0
  • Web
nasafrasa
23 Oct, 2024, 18:16

Hey! I'm a bit new new to this, but when I'm trying to get a list of executions from an appwrite function I've made, it returns these errors:

TypeScript
{
  "message": "No Appwrite project was specified. Please specify your project ID when initializing your Appwrite SDK.",
  "code": 401,
  "type": "general_access_forbidden",
  "version": "1.6.0"
}

here's my code on the client side:

TypeScript
import { Client, Functions } from "npm:appwrite";

const client = new Client();

await client
    .setProject('671839...') 
    .setEndpoint('https://cloud.appwrite.io/v1')

const functions = new Functions(client);

const promise = await functions.listExecutions(
    '67187c...',
);

console.log(promise)

I was using this as reference: https://appwrite.io/docs/references/cloud/client-web/functions#listExecutions I feel like I might be missing something obvious, help would be appreciated!

TL;DR
Documentation and tutorial for authentication and implementation provided. To resolve 401 Unauthorized error, make sure to specify the project ID when initializing the Appwrite SDK on the client side.
Kenny
23 Oct, 2024, 18:30

I'm pretty sure, in the client sdk, this route returns function executions where the currently logged in user is the executer. Do you have someone logged in? Have they specifically triggered an execution?

nasafrasa
23 Oct, 2024, 18:39

No I don't think I have someone logged in, how would I do that then...?

Kenny
23 Oct, 2024, 18:40

Here is the documentation for authentication https://appwrite.io/docs/references/cloud/client-web/account#createEmailPasswordSession

Here is a tutorial for implementing it in react https://appwrite.io/docs/tutorials/react/step-4

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more