404 Error with App Proxy in Node

Hey all,

I’m having an issue with a 404 error when requesting my app proxy. Here’s what I’m dealing with:

Proxy Settings:

Subpath Prefix: apps
Subpath: my_proxy
Proxy URL: https://aaa.ngrok.io/api

Client-Side:

syn.addEventListener('click', () => {
  const fetchOptions = {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      dummy_data: 5
    }),
  };
  return fetch("/apps/my_proxy/dummy_data", fetchOptions);
});

Server-Side:

app.post("/api/dummy_data", async (req, res) => {
  console.log("API")
  try {
    console.log("trying...");
    res.status(200).send({message: "Got it"});
  } catch (error) {
    res.status(500).send(error.message);
  }
});

The calls from the front end will always result in a 404, even though I’m fairly sure I followed the video tutorial on Shopify’s YouTube channel exactly. A request through PostMan to the ngrok server will provide the desired results.

If anyone has an insight into why this is happening it would be a life saver.

Deleting the app proxy and re-adding it exactly as I had it fixed my problem.

This would be the Shopify equivalent of turning it off and turning it back on again. Leaving the post for future searchers.

2 Likes