#[SOLVED] Getting Invalid Query exception and it's not the 14.0.0 version problem.

1 messages · Page 1 of 1 (latest)

dense bone
#

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

ionic spade
dense bone
#

I downgraded to "appwrite": "^13.0.2", I didn't knew the syntax was different

#

what should I do?

ionic spade
dense bone
#

thank you, working now!

#

🫰

ionic spade