Cannot access blogs from backend script

I’m having trouble with
I am trying to access blog posts from a back end script - eg:

import { Permissions, webMethod } from "wix-web-module";
import { posts } from "wix-blog-backend";

export const getPosts = webMethod(Permissions.Anyone, async () => {
  try {
    const results = await posts.queryPosts().find();
    const items = results.items;
    return items;
  } catch (error) {
    console.error(error);
  }
});

But no matter what variation of the back end blog functions I use (ID, Slug, etc), it always returns:

It seems to indicate a permission error. But the backend API is meant to allow me to, as a user, fetch blog posts. All I want to do is get the current blog post that the user is looking at - without connecting it as a dataset.

Working in
Wix Studio, Dev Mode, Blocks Builder

Use SDK instead, that’s more stable. Install the @wix/blog and @wix/essentials dependencies.

import { posts } from "@wix/blog";
import { auth } from "@wix/essentials";

async function myGetPostBySlugMethod(slug, options) {
  const elevatedGetPostBySlug = auth.elevate(posts.getPostBySlug);
  const response = await elevatedGetPostBySlug(slug, options);
}

Thanks for this!

I’ve tried that in a backend JSW file, and I get:

Error: {
  "message": "UNKNOWN",
  "details": {
    "applicationError": {
      "description": "UNKNOWN",
      "code": 403,
      "data": {
        "requestId": "1760776436.605438371385412339399",
        "details": null
      }
    },
    "requestId": "1760776436.605438371385412339399"
  }
}