[SOLVED] Getting Invalid Query exception and it's not the 14.0.0 version problem.
- 0
- Databases
- Web
- Cloud
Trying to navigate to a post I made, I get this error: Invalid query: {"method":"equal","attribute":"slug","values":["test-post"]} and I checked if the slugs are the same and they are. Not sure what the problem might be.
---
import { Query } from "appwrite";
import { databases } from "../../lib/appwrite";
import Layout from "../../layouts/Layout.astro";
import Container from "../../components/container.astro";
const { postSlug } = Astro.params;
const { documents } = await databases.listDocuments(
import.meta.env.PUBLIC_DATABASE_ID,
import.meta.env.PUBLIC_COLLECTION_ID,
[Query.equal("slug", String(postSlug))]
);
if (!documents.length) {
return Astro.redirect("/404");
}
const post = documents[0];
const publishedDate = new Date(post.$createdAt);
console.log("documents", documents);
---
<Layout title={`${post.title} - My Blog`}>
<Container>
<article class="prose mx-auto">
<h1 class="text-4xl font-extrabold mb-6">{post.title}</h1>
<p class="text-slate-500 mb-14">
<time datetime={publishedDate.toISOString()}
>Published {publishedDate.toLocaleDateString()}</time
>
</p>
<Fragment set:html={post.content} />
</article>
</Container>
</Layout>
The code above is my [postSlug].astro
You say it’s “not the 14.0.0 version problem”, but that is the Appwrite 1.5 Query syntax. What makes you say it’s not the SDK version?
I downgraded to "appwrite": "^13.0.2", I didn't knew the syntax was different
what should I do?
You should delete the node_modules/
folder, then run npm install
again
oh man I thought I already did, but it doesn't seem like it xd
thank you, working now!
🫰
Great! If your issue has been solved, you can mark this post as closed by adding "[SOLVED]" to the beginning of the title
[SOLVED] Getting Invalid Query exception and it's not the 14.0.0 version problem.
Recommended threads
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...
- Migrate from cloud to localhost
Hello everyone. I need to migrate my test project from cloud to localhost, however it seems that this is possible only if a self-hosted appwrite instance it's h...
- Current User is Not authorized
recreating same Thread