Create/Update using Assets API on Shopify React/Remix custom app returns 404

Hi @WarrenWolff ,

While we’re waiting for their response. I come up with a solution that works with our remix application. As an alternative, we can just make a Rest API call instead (did this inside the action router):

const { admin, session } = await authenticate.admin(request);

// Used admin.rest.resources.Theme for this
const mainTheme = await fetchMainTheme(request);

const options = {
  method: 'PUT',
  headers: {
    'X-Shopify-Access-Token': session.accessToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "asset": {
       "key": "templates/product.test-pdp-template.json",
       "source_key": "templates/product.json"
    }
  })
}
fetch(`https://${session.shop}/admin/api/2024-01/themes/${mainTheme.id}/assets.json`, options)
    .then(response => response.json())
    .then(data => {
       console.log("Data: ")
       console.log(data);
    })
    .catch(error => console.error("Error:" + error));

Sample Response:

01:32:15 │ remix │ {
01:32:15 │ remix │    asset: {
01:32:15 │ remix │      key: 'templates/product.test-pdp-3-template.json',
01:32:15 │ remix │      public_url: null,
01:32:15 │ remix │      created_at: '2024-02-14T12:32:15-05:00',
01:32:15 │ remix │      updated_at: '2024-02-14T12:32:15-05:00',
01:32:15 │ remix │      content_type: 'application/json',
01:32:15 │ remix │      size: 1629,
01:32:15 │ remix │      checksum: 'c797e11d248ad1a7a34d8b96dd4e8f03',
01:32:15 │ remix │      theme_id: 158160519488,
01:32:15 │ remix │      warnings: []
01:32:15 │ remix │   }
01:32:15 │ remix │ }

Hope this helps!