Back

general_route_not_found (NODE JS)

  • 1
  • Self Hosted
  • Auth
  • Tools
  • Cloud
Laxy Patel
13 Mar, 2024, 13:36

Error:

Error 404 The requested route was not found. Please refer to the API docs and try again.

Type

general_route_not_found

Details: "dependencies": { "cors": "^2.8.5", "express": "^4.18.3", "node-appwrite": "^12.0.0" } code: const token = await users.createToken("3423FFR23R23R2R3"); const endPoint = "https://cloud.appwrite.io/v1"; // my endpoint

Description: i am getting "general_route_not_found" when i use createToken at node js side. i can able to perfoem other methods like create etc. but when i use "createToke " getting this error please let me know if anyone have solution.

I appreciate any help you can provide.

TL;DR
Developers encountered a "general_route_not_found" error when using the createToken method in Node.js with the Appwrite SDK. The solution might involve checking the API docs for the correct route and ensuring it is implemented properly in the code. Additional clarifications or corrections may be needed in the implementation steps provided.
Laxy Patel
13 Mar, 2024, 13:37

general_route_not_found

Laxy Patel
13 Mar, 2024, 13:38

general_route_not_found (NODE JS)

Faye
13 Mar, 2024, 13:40

Could you share your code?

Laxy Patel
13 Mar, 2024, 13:40

Yes wait

Faye
13 Mar, 2024, 13:40

Make sure to not send any API keys or sensitive info.

Laxy Patel
13 Mar, 2024, 13:45

// index.js ( main file) this the end points where i sending request to create a token `app.post("/test-auth", async (req, res) => { console.log("req.body: ", req.body); try { const token = await users.createToken("3423FFR23R23R2R3"); const secret = token.secret;

TypeScript
res.json({ token: secret });

} catch (error) { console.log("err: ", error); res.json({ err: error.response, }); } });`

// setup.js

`import sdk from "node-appwrite";

const endPoint = "https://cloud.appwrite.io/v1"; const projectID = "PROJECT_ID"; const apiKey = "API_KEY;

const client = new sdk.Client() .setEndpoint(endPoint) // Your API Endpoint .setProject(projectID) // Your project ID .setKey(apiKey) // Your secret API key .setSelfSigned();

export let users = new sdk.Users(client);

export default client;`

Laxy Patel
13 Mar, 2024, 13:49

@Faye here's the code.

Faye
13 Mar, 2024, 13:55

Use 3 backticks like markdown next time and put your code in that, so it looks like this: 3 at top

TypeScript
code

3 at bottom

Faye
13 Mar, 2024, 13:56

why do you have .setselfsigned()?

Laxy Patel
13 Mar, 2024, 13:58

https://github.com/appwrite/sdk-for-node/blob/main/README.md

In this docs they mention

TypeScript
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
Laxy Patel
13 Mar, 2024, 13:59

Thanks will keep this in mind 🙂

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