Error with create Asset

Hi! I ran into a problem when I was creating a resource on the web side.
I am sending a request with this body to the local host:5173:
{
“ext”: “.mp4”,
“name”: “bruno2.mp4”,
“uri”: “/data/screenly_assets/a9f133f9898a5daebb1c620cd0b0844b.tmp”,
“start_date”: “2025-01-03T09:57:48.753Z”,
“end_date”: “2026-01-03T09:57:48.753Z”,
“duration”: 0,
“mimetype”: “video/mp4”,
“is_enabled”: true,
“is_processing”: true,
“nocache”: false,
“play_order”: 0,
“skip_asset_check”: true
} I getting this -
videos:1 Access to XMLHttpRequest at ‘http://176.123.167.23/api/v2/assets’ from origin ‘http://localhost:5173’ has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

But if I send another exactly the same request to Bruno (an application similar to Postman), everything goes well. I would really appreciate your help :slight_smile:

@Nicky, that’s interesting. Here are a few questions for you to answer so that we could rule things out:

  • Are you using a VPN in your network?
  • What value did you set for the Content-Type in your request (via Bruno)?
  • Could you please provide details like screenshots or video recordings showing how you attempted to send a request via the browser? It is recommended to send an API request via an API testing tool (like Postman, Bruno, Insomnia, or cURL if you prefer to do things via CLI).

I’ve been doing calls to POST /api/v2/file_asset and POST /api/v2/assets several times and haven’t experienced an issue.

There’s one thing that I noticed:

  • When the call to POST /api/v2/assets fails (for instance, due to a non-zero duration being given to the request body), I have to do a request to POST /api/v2/file_asset again, and then do the API call for creating an asset again.

I hope this helps.

1 Like

Yes, that’s config of my bruno and my web requests

web:
export const createVideo = async (Video: Video) => {
const response = await apiClient.post(“/api/v2/assets”, Video, {
headers: {
“Content-Type”: “application/json”,
},
});
return response.data;
};

And this is bruno on photos, adding header - content type, as in web side

Error, that I facing -

Thank you!

@Nicky, let me check the back-end source code. It might have been missing something.

1 Like

Adding to my previous comment - this path http://176.123.167.23/api/v2/assets/order also work only on bruno, CORS policy blocked this from browser

So, could you please help me with my problem?

@Nicky, apologies for getting back just now. Let me check that. The web server must need some CORS handling so that the issue can be fixed.

I’ll keep you posted.

1 Like

@Nicky, I’m currently fixing how CORS is being handled in Anthias. While I’m at it, I would like to ask the following questions:

  • How did you install Anthias?
  • Are you running a local development instance or on a Raspberry Pi or x86 device?
  • Are you trying to access the home page of the web interface?
1 Like
  1. Standard script: bash <(curl -sL https://install-anthias.srly.io)
    tag: latest
    system upgrade: No

  2. Local instance, x86 Debian 12.

3)I exactly didn’t understood this question. If you about my web host - there is localhost:5173

About #3, I was asking if you are trying to access “http://<IP_ADDRESS_OF_MACHINE>” from a browser of your choice (for example, Chrome).

I’m really sorry for long expectation, it’s been really hard two weeks for me and I just haven’t much time to open this project
If I’ve correcly catch your sense, so I tried get it from http://localhost:5173

@Nicky, if using localhost didn’t work, you have to use an IP address instead.
I would like to clarify the following:

  • Are you trying to fetch data from the REST API from a front-end that you’re trying to build on your own?