One of the stores that has installed my app is having issues sending request to my REST API via the app proxy. The requests sent to https://example.myshopify.com/apps/proxy are returning a GraphQL error and not hitting my REST API. What could be the issue?
{
"errors": [
{
"message": "GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension.",
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
]
}
Relevant part from shopify.app.toml
[app_proxy]
url = "https://my.rest.api.com/api/proxy"
subpath = "proxy"
prefix = "apps"
client code
async function callApi(): Promise<string | undefined> {
try {
const res = await fetch("/apps/proxy", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
hello: "world"
}),
});
const json: ProxyResponse = await res.json();
return json.success && json.data ? json.data : undefined;
} catch (err) {
console.error("request failed", err);
return undefined;
}
}