The problem in saving an asset through api

Hi, I’m facing a very strange problem that I can’t seem to figure out.

I’m trying to make a plugin to insert 2 collection scripts in the current Shopify theme, but every time I get the “Not found” error, but all the inputs are correct, I also checked the theme id and the path of an asset and everything OK

const test = await shopify.api.rest.Asset.all({session: session, theme_id: theme.id, asset: {"key": "layout/theme.liquid"}});
const asset = new shopify.api.rest.Asset({session: session});
                asset.theme_id = test.data[0].theme_id;
                asset.key = "layout/theme.liquid";
                asset.value = "

We are busy updating the store for you and will be back within the hour.

";
                await asset.save({
                    update: true,
                });

My response

2023-05-10 06:11:17 │ backend  │ HttpResponseError: Received an error response (404 Not Found) from Shopify:
2023-05-10 06:11:17 │ backend  │ "Not Found"

Hello,

I have exactatly the same problem, did you found an issue?

I have the same issue can you find any kind of solution @RecomazeAI , @wil_dev
If you find then give the solution.

Hi @RecomazeAI ,

Seems that we have a similar problem. I have posted a workaround while we’re waiting for them to fix this. I have reached out to the Shopify Partner regarding this issue and I do recommend you to send out a ticket as well.

Please refer to this link for the workaround:

https://community.shopify.com/post/2443997

Hope that helps!