Astro / Bun - Error reading db
I am getting
{ message: 'Forbidden resource', error: 'Forbidden', statusCode: 403 }
from console.log...
Server is running on localhost:1111, I tried to specify it, thinking it might try to do https, but it is not that. Not sure what to try next.
When trying Astro example:
---
import ManifestSDK from "@mnfst/sdk";
// Init SDK.
//const manifest = new ManifestSDK();
const manifest = new ManifestSDK("http://localhost:1111");
// Fetch the cat list.
const result = await manifest.from("cats").find();
console.log(result);
const cats = result.data;
---
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>Astro</title>
</head>
<body>
<ul>
{cats.map((cat) => <li>{cat.name}</li>)}
</ul>
</body>
</html>

10 Replies
I did run manifest:seed... but when I go to the api, I get same error. Which means... something is off with data
It must be something simple but I can't figure it out...
Also when I login as admin, I can see plenty of cats... ๐
Hello @Desireco
This is beacause by default the data is private and limited to administrators ! You can add a public policy for "read" action like this:
In this case, everyone can see the invoices (access: public) and the other rules (create/update/delete) are limited to admins.
I had a look at the docs and I admit that it is not pretty clear, I am going to adapt it: https://manifest.build/docs/authentication#api-policies
I created a new page for policies only https://manifest.build/docs/access
Access policies | Manifest Docs
Access Policies ensure that we provide specific access to resources for users. You may want to open publicly the read access for an entity while limiting creation to logged in users for example.

Maybe that would be mentioned in the guide... because I was following it. Also typescript didn't like two things being called Manifest. I am happy to help with docs
I mean, thank you ๐
Hey @brunobuddy this works well, thank you and explains a lot. Would you guys mind that I update guide with this point, you just have to point me into direction so I can help.
Now homepage is refusing access even though I said (copied and pasted) access to public ๐ Can you look at this file and enlighten me... these are all simple things

Pls help
@Desireco can you copy paste your all yaml file in plain text using
I recreated astro and installed manifest and same error, here is config file, hopefully you will have some idea @brunobuddy , btw the only other things is that I used Bun, but I can reinstall with npm. See if you can spot something.
Hello @Desireco I created a sample project on Stackblitz based on your backend.yml file and it worked. On the terminal you can click on the API doc link to see the doc and try the GET request to /api/singles/homepage and get the content.
Are you calling the correct URL with the correct method ?
https://stackblitz.com/edit/mnfst-manifest-cr7yime1?file=manifest%2Fbackend.yml
Bruno
StackBlitz
Manifest Main Demo Example (forked) - StackBlitz
Run official live example code for Manifest Main Demo, created by Mnfst on StackBlitz
I think I do, I just made another singular resource and it is also forbidden, also tried stopping everything and deleting db and recreating. OK let me try with slightly different tech. Weird that it would work for collections but not for singular.
Appreciate your effort to help me
I have a project I would like to do in Astro with Manifest, need to figure this out somehow ๐
Ok figured it out... I used collection methods for singles... thanks.
Like this instead of find
// Get the homepage entity.
const homepage = await manifest.single('homepage').get()