Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Error: Not Found when using 0.20.0-inbox-combined.1 #449

Open
kingthrillgore opened this issue Jan 18, 2025 · 2 comments
Open

Getting Error: Not Found when using 0.20.0-inbox-combined.1 #449

kingthrillgore opened this issue Jan 18, 2025 · 2 comments

Comments

@kingthrillgore
Copy link

Using the latest version on npm and when I attempt to run the example in the readme, it dies from a Not Found error. Was there a change in the Lemmy API recently or am I missing something?

PS E:\lemmy_image_downloader_ts\build> node .\test.js
Running script
E:\lemmy_image_downloader_ts\node_modules\.pnpm\[email protected]\node_modules\lemmy-js-client\dist\http.js:1158
            throw new Error(response.statusText);
                  ^

Error: Not Found
    at LemmyHttp.<anonymous> (E:\lemmy_image_downloader_ts\node_modules\.pnpm\[email protected]\node_modules\lemmy-js-client\dist\http.js:1158:19)
    at Generator.throw (<anonymous>)
    at rejected (E:\lemmy_image_downloader_ts\node_modules\.pnpm\[email protected]\node_modules\lemmy-js-client\dist\http.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.12.2
PS E:\lemmy_image_downloader_ts\build>

Compiled TS follows

import { LemmyHttp, Login } from "lemmy-js-client";

console.log("Running script");

// Build the client
const baseUrl = "https://lemmy.ml";
const client: LemmyHttp = new LemmyHttp(baseUrl);

// Build the login form
const loginForm: Login = {
  username_or_email: "<EMPTY>",
  password: "<EMPTY>",
};

// Login and set the client headers with your jwt
const { jwt } = await client.login(loginForm);
client.setHeaders({ Authorization: `Bearer ${jwt}` });

console.log(jwt);

// Fetch top posts for the day
// Commented out as GetPosts doesn't exist here
/* const getPostsForm: GetPosts = {
  sort: "TopDay",
  type_: "Local",
};
const posts = await client.getPosts(getPostsForm); */
@Nutomic
Copy link
Member

Nutomic commented Jan 20, 2025

Are you running with a Lemmy 0.20 backend? Because there are many breaking changes compared to 0.19

@dessalines
Copy link
Member

dessalines commented Jan 20, 2025

That's an experimental unreleased lemmy-js-client, are you working on developing something? Because you shouldn't be using unreleased versions otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants